dgraph
dgraph copied to clipboard
[ENHANCEMENT]: Sorting using facets
Use case and current behavior
Currently list predicates can only be sorted by facets if the facets are edge attributes (list of UIDs). Sorting by facet does not work if the facets are for any other kind of list predicates (strings, ints, datetime, etc)
Enhancement
Consider the following mutation
<_:node> <list_predicate> "Value 1" (weight=90) .
<_:node> <list_predicate> "Value 2" (weight=70) .
<_:node> <list_predicate> "Value 3" (weight=30) .
<_:node> <list_predicate> "Value 4" (weight=100) .
I would like to sort the values of the list predicate by the facet weight:
{
q(func: has(list_predicate)) {
list_predicate @facets(orderasc: weight)
}
}
Currently, orderasc: weight is ignored. Desired output:
{
"q": [
{
"list_predicate": [
"Value 3",
"Value 2",
"Value 1",
"Value 4"
],
"list_predicate|weight": {
"0": 30,
"1": 70,
"2": 90,
"3": 100
}
}
]
}
Solution proposal
No response
Links to Discuss, RFC or previous Issues and PRs
No response
Links to examples and research
No response
Additional Information
No response