Order results by a pre-sorted list

Experience Report for Feature Request

What you wanted to do

Provide a pre-sorted list of ids (uids) and return results with pagination by order

What you actually did

Nothing, not possible

Why that wasn’t great, with examples

We cannot do sorting and pagination all on client side because we are combining this sorted list with other filters. So our ordered list might be [0x1, 0x2, 0x5, 0x4] but another filter is not: { field: { eq: "..." } } which might exclude 0x2 and 0x5 but we don’t know that on the client side. If we were to just get all results and then order them locally, then we lose the performance of just getting the first page of results that we are displaying and potentially return thousands of results to just get the first 10 and potentially very quickly a user changes a filter and we would need to fetch ALL results again.

Any external references to support your case

Basically we are trying to adhoc some search ranking and before in a rdbms we used a ranking field that we created within the query and gave score values and then sorted by those scores, since we cannot ad an field in the query to give scores to with filters then we are trying to work around that.

2 Likes