Exemplo n.º 1
0
 async def query(tx):
     query = [
         [var("blog"), "title", "hyper.dev"],
         [var("post"), "blog", var("blog")],
         [var("post"), "title", var("title")],
     ]
     out = await aiolist(nstore.query(tx, ntest, *query))
     return out
Exemplo n.º 2
0
async def _keywords_to_token(tx, tokens, keyword):
    query = nstore.select(tx, tokens, keyword, nstore.var('uid'))
    try:
        uid = await query.__anext__()
    except StopAsyncIteration:
        return None
    else:
        uid = uid['uid']
        return uid
Exemplo n.º 3
0
async def index(tx, store, docuid, counter):
    # translate keys that are string tokens, into uuid4 bytes with
    # store.tokens
    tokens = dict()
    for string, count in counter.items():
        query = nstore.select(tx, store.tokens, string, nstore.var('uid'))
        try:
            uid = await query.__anext__()
        except StopAsyncIteration:
            uid = uuid4()
            nstore.add(tx, store.tokens, string, uid)
        else:
            uid = uid['uid']
        tokens[uid] = count

    # store tokens to use later during search for filtering
    found.set(tx, found.pack((store.prefix_counters, docuid)),
              zstd.compress(found.pack(tuple(tokens.items()))))

    # store tokens keys for candidate selection
    for token in tokens:
        found.set(tx, found.pack((store.prefix_index, token, docuid)), b'')
Exemplo n.º 4
0
 async def query(tx):
     query = nstore.select(tx, ntest, var("blog"), "title", "hyper.dev")
     query = nstore.where(tx, ntest, query, var("post"), "blog", var("blog"))
     out = await aiolist(nstore.where(tx, ntest, query, var("post"), "title", var("title")))
     return out
Exemplo n.º 5
0
 async def query(tx):
     out = await aiolist(nstore.select(tx, ntest, hyperdev, "title", var("title")))
     return out
Exemplo n.º 6
0
 async def query(tx):
     out = await aiolist(nstore.select(tx, ntest, copernic, var("key"), var("value")))
     return out
Exemplo n.º 7
0
 async def query(tx):
     out = await aiolist(nstore.select(tx, ntest, var("subject"), "keyword", "corporate"))
     return out
Exemplo n.º 8
0
 async def query(tx):
     seed = nstore.select(tx, ntest, var("identifier"), "keyword", "hacker")
     out = await aiolist(nstore.where(
         tx, ntest, seed, var("identifier"), "title", var("blog")
     ))
     return out
Exemplo n.º 9
0
 async def query(tx):
     out = await aiolist(nstore.select(tx, ntest, var("subject"), "title", "hyper.dev"))
     return out