I would like to ask a sorting question
MATCH (u:User)-[r:COLLECT]->(c:Collection)
WHERE id(u)=3142990 AND c.state='buy' WITH c
ORDER BY c.`orderTime` DESC SKIP $skip LIMIT 20
MATCH (c)-[r2:COLLECT_TO]->(i:Hobby) RETURN *
int skip = 0;
and
int skip = 20;
The last item in the list on the first page is equal to the first item on the second page!
I found out how to handle it
The accuracy of 'orderTime' is insufficient
Yes, if the fields used for ordering are not distinct, then the ordering across pages may be ambiguous with respect to rows with the same ordered values.
If ordering with respect to nodes (and if the nodes are distinct across all rows), you can always additionally order by the id() of the node for determinant ordering when paging.
1 Like