I want to filter nodes whose email address not contain a constent word. For the reason that allofterms is case insensitive, and i want case sensitive, so I try use regex to do it.
I have nodes A, B, C
with address
result(func: uid(A,B,C)) @filter(regexp(email, /Address/)){**
name
}
it return node A and B
while use
result(func: uid(A,B,C)) @filter(NOT regexp(email, /Address/)){**
name
}
it should return node C, but it doesnât return any node.
did I do the right thing? or there is any way to reach what I want.
I use dgraph1.1 and on win10
Thanks anyway
You would never have this result using regex. Because all other emails have âAddressâ. Soon they will be excluded as well.
You can try like this:
{
#I'm not saying you have to use hass. Just an example.
A as q(func: has(email)){
email
}
RS as result(func: uid(A)) @filter(regexp(email, /Address/)){
email
}
result2(func: uid(A)) @filter(NOT uid(RS)){
email
}
}
Thanks for your response. the way you suggested works well.
But I still confuse where I was wrong. The regexp operation is case sensitive, so I think @filter(NOT regexp(email, /Address/) should not exclude all email for that the last email contains âaddressâ not âAddressâ.
Very hard to tell. But if thatâs reproducible (And easy to reproduce) in any Windows env. So itâs a bug and an issue must be filled so we can track it and solve it.
We recently had problems with the windows file system. And to solve it took a while, because nobody on the team uses Windows. Dgraph supports Windows, but for tests and study usage. We do not recommend creating a Windows cluster. Although you can do it. In that case, I would recommend using WSL to avoid problems. We have never tested WSL, but it seems safe.
I retried it on the Docker today, and I got the same error result.
this is my rdf file and schema file: regexp_test.rdf (233 Bytes) regexp_test.schema (134 Bytes)
I dropped my DB and started a totally new one. Then I used dgraph live to inport the data.
I was using a very recent binary based on the Master branch. In recent weeks there have been changes to the Regex code from some issues resolved by Core Devs. So that explains why I couldnât reproduce your case. You are using a v1.1.0 release and I am using Master. I did the test here to prove it works in Master but not in v1.1.0.
So it is solved. Wait for a new release that this will come fixed.
PS. The repo download the 1.1.0 version. So the issue will happen if you just try it out. If you need to test with master, you need to Build it from master.