Filtering on same predicate using multiple indices give unexpected result

Moved from GitHub dgraph/5812

Posted by anurags92:

What version of Dgraph are you using?

Dgraph version : v2.0.0-rc1-452-g5c75240a3
Dgraph SHA-256 : c3fa23e3909376d2b5e567cbe963a81132c9c83e7e40b4051d56cba8105dece2
Commit SHA-1 : 5c75240a3
Commit timestamp : 2020-07-02 11:02:02 -0700
Branch : master
Go version : go1.14

Have you tried reproducing the issue with the latest release?


What is the hardware spec (RAM, OS)?

RAM: 16gig
OS: Linux/Ubuntu
Model name: Intel® Core™ i7-7700 CPU @ 3.60GHz

Steps to reproduce the issue (command/config used to run Dgraph).


name: string @index(term, trigram) .


    set {
        _:a <name> "Foo Edit" .
        _:a <dgraph.type> "User" .

        _:b <name> "Foo Edit1" .
        _:b <dgraph.type> "User" .

        _:c <name> "Ba" .
        _:c <dgraph.type> "User" .

        _:d <name> "Bar" .
        _:d <dgraph.type> "User" .

        _:e <name> "Barry" .
        _:e <dgraph.type> "User" .


    q (func: type("User")) @filter(anyofterms(name, "foo") OR match(name, "ba", 5)) {

Expected behavior and actual result.

Expected results: All 5 nodes
Actual results: nodes for (“Ba”, “Bar”, “Barry”)