I Want to Do
I want to search through nodes using a regular expression, and I want the results to be paginated. I’d like to be able to use after
for pagination as it is more accurate.
What I Did
schema {
predicate: string @index(term, trigram) .
}
<_:blank-0> <predicate> "hello 1" .
<_:blank-1> <predicate> "hello 2" .
<_:blank-2> <predicate> "hello 3" .
query query($q: string, $first: int, $after: string) {
result(func: regexp(predicate, $q), first: $first, after: $after) {
uid
}
}
with $q
set to /^hello/
, $first
set to 1
, and $after
set to any 0x[0-9a-f]* value.
Regardless of what I pass as $after
, the result array always includes the hello 1
node. offset
works as expected but I’d prefer to use after
if at all possible.
eq
queries seem to work as expected. I haven’t tested every function but so far only regexp
seems to exhibit this behavior.
Dgraph Metadata
dgraph version
Dgraph version : v20.07.3
Dgraph codename : shuri-3
Dgraph SHA-256 : aac388cb92a9fa425aeab7361697bc66e8261e0773c7318729104482b87eccd4
Commit SHA-1 : 40a7526d6
Commit timestamp : 2020-12-29 13:24:26 +0530
Branch : HEAD
Go version : go1.15.5```
</details>