Sorting by multiple facets


(Kevin Orr) #1

You can use orderasc to sort by multiple predicates, which will combine their orderings using lexicographic ordering. You can also use orderasc to sort by the value of a facet, e.g.

{
  asdf(func: has(edge)) {
    uid
    edge @facets(kind, index, orderasc:index) {
      uid
    }
  }
}

However, when I try to sort by multiple facets, e.g.

{
  asdf(func: has(edge)) {
    uid
    edge @facets(kind, index, orderasc: kind, orderasc:index) {
      uid
    }
  }
}

I get the error "Invalid use of orderasc/orderdesc in facets". Is there any way to order by multiple facets?

Version:

Dgraph version   : v1.0.15
Commit SHA-1     : ff5ee1e2
Commit timestamp : 2019-05-30 15:46:55 -0700
Branch           : HEAD
Go version       : go1.12.5

(Michel Conrado) #2

Unfortunately this does not work, but feel free to request this on Github.