0

I'm moving my project from SDN 3 to SDN 4 and from Neo4j 2.3 to 3.0.1

I have a following Spring Data Neo4j repository method:

 @Query(value = "START d=node:node_auto_index({autoIndexQuery}) MATCH (d:Decision) RETURN d", countQuery = "START d=node:node_auto_index({autoIndexQuery}) MATCH (d:Decision) RETURN count(*)")
 Page<Decision> searchDecisions(@Param("autoIndexQuery") String autoIndexQuery, Pageable page);

Right now in SDN 4 I can't find a way to provide this countQuery to Query annotation.

How it can be done in SDN 4 ?

Rob
  • 14,746
  • 28
  • 47
  • 65
brunoid
  • 2,121
  • 2
  • 12
  • 22

1 Answers1

2

Paging for custom queries is not supported yet in SDN 4. The only option is to use skip and limit, passing in those parameters.

For example,

@Query(value = "START d=node:node_auto_index({autoIndexQuery}) MATCH (d:Decision) RETURN d ORDER BY d.something SKIP {skip} LIMIT {limit}")
 List<Decision> searchDecisions(@Param("autoIndexQuery") String autoIndexQuery, @Param("skip") int skip, @Param("limit") int limit);
Luanne
  • 19,145
  • 1
  • 39
  • 51
  • When do you plan to add Paging support for custom queries to SDN ? – brunoid Jun 06 '16 at 05:48
  • At the moment this hasn't been assigned to a specific release. You can track the issue here https://jira.spring.io/browse/DATAGRAPH-653 – Luanne Jun 06 '16 at 06:18