Before anything, for you case maybe you could find some info here https://docs.dgraph.io/query-language#term-matching
The idea of having the first name inside the node “family”, does not make much sense to me. Could you elaborate? If a family has multiple “Bob” how you can keep each “Bob” unique? You should create a “tree” for it oO. It is better that there is a family name then you filter by the family name you want to find.
About Var Blocks https://docs.dgraph.io/query-language/#var-blocks
About Reverse Edges https://docs.dgraph.io/query-language#reverse-edges
In that case to see what family the user is. You need to put family as “@reverse”. If the family has to be unique, you must give a single markup for each or “save/collect/keep” your UIDs in another way.
Can you try this?
{
var(func: has(family)) {
family @filter(allofterms(name@en, "Bennett Russell Diaz")) {
~family {
myVar AS uid
}
}
}
userWithfamily(func: uid(myVar), orderasc: name) {
name@en
age
family {
family_name
}
}
}