How to working with facets?


(abbass) #1

i have much persons, each one haves a facet (“weight”)
Can I get the person who has the most weight?


(Michel Conrado (Support Engineer)) #2

Yes you can do it. With filters https://docs.dgraph.io/query-language/#filtering-on-facets

But it depends the way you’re doing the “weight”. In overall you will need to create a Var block. Within this find the desired weight and return your UID in the main query. Depending on your context you will do weight evaluation on reverse predicates. Or from parent to Child like this https://docs.dgraph.io/query-language/#assigning-facet-values-to-a-variable.

update: Check this https://docs.dgraph.io/query-language/#facets-and-variable-propagation


(Michel Conrado (Support Engineer)) #3

Sorry the link math-on-value-variables was wrong.