Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENHANCEMENT]: Sorting using facets #8992

Open
mrwunderbar666 opened this issue Sep 4, 2023 · 0 comments
Open

[ENHANCEMENT]: Sorting using facets #8992

mrwunderbar666 opened this issue Sep 4, 2023 · 0 comments
Labels
kind/enhancement Something could be better.

Comments

@mrwunderbar666
Copy link

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

@mrwunderbar666 mrwunderbar666 added the kind/enhancement Something could be better. label Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Something could be better.
Development

No branches or pull requests

1 participant