After and orderdesc: question on large datasets, ordering, and pagination

Ha!, just realized you can’t even do this with orderasc either. I never really utilized after, but this makes it useless if there is no way that I see to use it in conjunction with ordering at all. I even tried using a block to do the ordering and pagination in separate blocks, and it still did not work as expected.

# DQL
query {
  sortedAndPaginated(
    func: has(name),
    orderasc: name,
    after: 0xfffd8d7297c1984f
  ) {
    uid
    name
  }
  chars as sorted(func: has(name), orderasc: name) {
    uid
    name
  }
  paginated(
    func: uid(chars),
    after: 0xfffd8d7297c1984f # Luke Skywalker
  ) {
    uid
    name
  }
}
// Response
{
  data:{
    sortedAndPaginated: [
      {
        uid:"0xfffd8d7297c19851",
        name:"Han Solo"
      },
      {
        uid:"0xfffd8d7297c19850",
        name:"Princess Leia"
      }
    ]
    sorted:[
      {
        uid:"0xfffd8d7297c19851",
        name:"Han Solo"
      },
      {
        uid:"0xfffd8d7297c1984f",
        name:"Luke Skywalker"
      },
      {
        uid:"0xfffd8d7297c19850",
        name:"Princess Leia"
      }
    ],
    paginated: [
      {
        uid:"0xfffd8d7297c19850",
        name:"Princess Leia"
      },
      {
        uid:"0xfffd8d7297c19851",
        name:"Han Solo"
      }
    ]
  }
}
1 Like