I am trying to find nodes that have a certain string value in some of its string predicates. For all those nodes, I want to only retrieve the predicates that match the string value, not the others.
What I did
I ran the following query:
{
pred1 as var(func: has(<first_name>)) @filter(eq(<first_name>, "George"))
pred2 as var(func: has(<last_name>)) @filter(eq(<last_name>, "George"))
result (func: uid(pred1,pred2)) {
uid
<first_name> @filter(eq(<first_name>, "George"))
<last_name> @filter(eq(<last_name>, "George"))
}
}
I get all uid’s that have the string "George" in either first_name or last_name, but I retrieve both predicates no matter if they match the eq filter.
How can I filter server-side to retrieve only those predicates that match the filter?
I want to retrieve all nodes that have either first_name or last_name equal "George", and for those nodes I want to only retrieve the predicate that equals "George".