Sorting on a list predicate?

Is there a way to sort by a scalar list predicate?

type Child {
  name
  toys
}

name: string @index(exact) .
toys: [string] @index(exact) .

If Child A were to have Toys: ["ball", "sword", "phone"] and Child B were to have Toys: ["ball","sword"], and I want pull the full list of children sorted by the type of toys they have and then their name. I tried something like

Query {
  var(func: eq(toys, "phone")) {
    ownedToys as toys
  }

  sortedChildren(func: type(Child), first:10, orderasc: val(ownedToys), orderasc: name) {
    uid
    name
    toys
  }
}

And I get "message": ": Value variables not supported for predicate with list type.",

According to this page and the message itself, there’s no way to sort using a list predicate. Is this the case or is there some fancy way to do this via a bunch of queries?

1 Like

Sorry, but that’s not possible. You should do it at level application.