Can anyone confirm the state of pagination and sorting in OGM for custom queries these days?
I found this JIRA: Support paging and sorting for custom queries [DATAGRAPH-653] · Issue #1219 · spring-projects/spring-data-neo4j · GitHub
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?