The query in Step 6 doesn't return correct results

Moved from GitHub tutorial/102

Posted by shekarm:

  everyone(func: anyofterms(name, "Michael Amit")) {
    friend {
      friend { expand(_all_) { expand(_all_) } }

The above query does not really select Amit. Since Amit doesn’t have ‘name’ attribute, the results are correct from dgraph’s perspective. But it could be confusing for the reader, who will likely expect Amit and his friends to be selected.

It may be useful to qualify the name with name@. so Amit (who doesn’t have the plain name attribute) would be selected.

MichelDiz commented :

@shekarm Michael doesn’t have @en in the dataset. So we choose one over the other or add name in Amit without tag, or set Michael’s name with @en tag.

If I change the query to anyofterms(name@en, "Michael Amit")only Amit appears. I’m not sure what was the intentions of who did this part of this tutorial.

I’m ready to do it, but I need to know what decision to take.

shekarm commented :

I would suggest that we use a different person other than Amit – someone who has the name attribute defined. This way the reader gets the results that are consistent with his/her understanding. The next tutorial clarifies the name@. concept.