cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Is there any document/code sample talking about pagination of query relationship in SDN 6?

I am in the process to upgrade Neo4j from SDN 5 to SDN 6 and I have found that all query pagination is no longer working since the relationship data is now put within the node entity. In such new SDN 6 case, how do we do pagination on the query to the relationship data? Is there here any documentation/sample code to help solve this ?

1 REPLY 1

I see two questions there.
Question one: How to get relationships back?
Question two: How to paginate with relationships?

For question one: SDN is 100% focused on nodes as entities. This means that you can only can get a hold of the relationships if you load the relationship defining nodes.

Question two: Given a scenario with User and Hobby resulting in the following pseudo-Cypher graph:

(User1)-[:LIKES{since: 1993}]->(Football)
(User1)-[:LIKES{since: 2015}]->(Music)
(User2)-[:LIKES{since: 2010}]->(Darts)
...

You could create a pagination query like:

@Query(
value = "MATCH (u:User)-[l:LIKES]-() return u ORDER by l.since SKIP $skip LIMIT $limit",
countQuery = "MATCH (u:User) return count(u)")