How to implement keyword based relevance sorting

{
  me(func: Type(Document)) @filter(allofterms(keywords, "All target Keywords here")) {
    count(uid)
  }
}

I was about to work on it, but reading further I noticed that this is really not possible. Dgraph can’t count the number of terms found in a predicate. It counts nodes/edges only.

I think you should do something similar to
https://github.com/dgraph-io/dgraph/issues/3211#issuecomment-505932373

Not saying that your problem is the same, just the example I did would be similar.

2 Likes