Sorting doesn't work on queries with cascade

Using DGraph Cloud.

When adding sorting to a query that’s using the @cascade directive, results are omitted showing only a small percentage of all the nodes.

All these three queries are identical except for the fact that one doesn’t sort, the other one sorts in ascending order and the last one in descending order, and the number of nodes returned is different for each query. I had already raised this issue last year and it seems to me that this is a very critical bug since it basically impedes users from sorting if we want to filter on a nested node (since we have to use cascade). Are there any plans on fixing this?

1 Like

Hey @danielhr I’m not able to reproduce your issue on 21.03 (dgraph cloud). Let’s see if we can track down this issue.

Can you have a look at this sandbox repo:

It’d be great if you could spin this up and verify the results that I get (count is correct regardless of sorting). Maybe compare my schema to yours, what’s different? Maybe there’s something in your data that’s different from mine.

1 Like

Maybe read this thread


Hey, thanks for reaching out.

My schema has the following differences:

  currentPrice: Float @search # on Product
  name: String! @id @search(by: [hash]) # on Category

I guess the data might also be what’s causing the issue, I PMed you my endpoint so you can repro.

The @search directive on the currentPrice edge seems to be the/an issue. I’m not seeing the exact result you experienced: dgraph reports an error (the container exits and restarts) and I get back empty results, not just inaccurate results like you’re seeing.

If I use the 21.03.01 version image (instead of the 21.03.0 version), no issues exist. I believe the cloud is on 21.03.0 – but I can’t confirm that because I’m unable to log into at the moment :confused:

Okay. Please get back to me once you confirm. In either case, can you reproduce on my endpoint or is there a way for me to debug this? Like looking at my endpoint’s logs.

I can confirm that cloud is running 21.03.0 I’m not a dgraph employee so I cannot access your endpoint.

If you can live without the @search directive on the currentPrice edge, I’d say that’s your closest path to joy.

1 Like

Okay, thank you so much for your help!

@fulsmita is there any ETA on when this will be addressed?