Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
09-26-2018 08:10 AM
Can anyone confirm the state of pagination and sorting in OGM for custom queries these days?
I found this JIRA: https://jira.spring.io/browse/DATAGRAPH-653
but the latest SDN docs say its not supported?
Neo4j OGM does not yet support sorting and paging on custom queries.
My custom repository method looks like this:
@Query(value = "MATCH (workflow:Workflow {active: TRUE})"
+ "<-[:CONTAINS_WORKFLOW]-(process:Process {active: TRUE}) "
+ "RETURN workflow.id AS id, workflow.name AS name, workflow.objectName AS objectName, "
+ "{id: process.id, name: process.name} AS process ORDER BY workflow.priority ASC;",
countQuery = "MATCH (workflow:Workflow {active: TRUE})<-[:CONTAINS_WORKFLOW]-(process:Process {active: TRUE}) "
+ "RETURN COUNT(workflow);"
)
List<WorkflowResult> findActiveWorkflowsWithProcesses(Pageable pageable);
It sends over this from what the bolt requests are saying:
MATCH (workflow:Workflow {active: TRUE})<-[:CONTAINS_WORKFLOW]-(process:Process {active: TRUE}) RETURN workflow.id AS id, workflow.name AS name, workflow.objectName AS objectName, {id: process.id, name: process.name} AS process ORDER BY workflow.priority ASC with params {0={sort={sorted=false, unsorted=true}, offset=0, pageSize=20, pageNumber=0, unpaged=false, paged=true}}
but the actual response doesn’t seem to respect the pagination.
Should we be manually putting in LIMIT
and SKIP
into our custom queries?
Solved! Go to Solution.
09-26-2018 09:00 AM
Solution was I need to return Page<WorkflowResult>
instead of List<WorkflowResult>
09-26-2018 09:00 AM
Solution was I need to return Page<WorkflowResult>
instead of List<WorkflowResult>
09-26-2018 02:01 PM
(Just a note for future users )
You are referring to the Neo4j-OGM documentation. The statement is true: No pagination support for custom queries.
You are using SDN and it supports pagination.
09-26-2018 02:02 PM
Ah. That makes sense since OGM really only concerns itself with the POJOs themselves.
All the sessions of the conference are now available online