I'm implementing infinite scroll and trying to get new items every time the user reach the bottom of the page.
problem is, neo4j return nodes that were already returned.
I read that ORDER BY
is must for this case, but it didn't help.
I tried follow the solution here: How to paginate query results with cypher?, and put the pagination clauses (LIMIT, SKIP...)
before the WITH
clause, but it didn't work. It also throw an error
the query:
MATCH(shops: Shop)
WHERE shops.title = ~ '(?i).*${search}.*'
WITH shops
ORDER BY shops.title asc
SKIP $skip
LIMIT $limit
MATCH(products: Product) < -[relation: SELL] - (shops)
RETURN shops, products, relation
how the query can guarantee new items on each request ?
*note - the limit
is always 12, and skip
is the items array length, the client app contain on the request.
EDIT 1 - IMAGES FROM THE DB OF THE DUPLICATION
it can be shown that a node with the same id, is returned from the two queries.
1ST page - skip 0, limit 12
2ND page - skip 12, limit 12