Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
spring数据neo4j@Query countQuery_Neo4j_Cypher_Spring Data Neo4j - Fatal编程技术网

spring数据neo4j@Query countQuery

spring数据neo4j@Query countQuery,neo4j,cypher,spring-data-neo4j,Neo4j,Cypher,Spring Data Neo4j,包org.springframework.data.neo4j.annotation中的annotation@Query提供了某些计数属性,如countQuery、countQueryName /** * @return simpler count-query to be executed for @{see Pageable}-support {self} will be provided by the node-id of the current entity other paramete

包org.springframework.data.neo4j.annotation中的annotation@Query提供了某些计数属性,如countQuery、countQueryName

/**
 * @return simpler count-query to be executed for @{see Pageable}-support {self} will be provided by the node-id of the current entity other parameters (e.g. {name}) by the given named params
 */
String countQuery() default "";

/**
 * @return name of the named count query to be used for this annotated method, instead of Class.method.count
 */
String countQueryName() default "";
谁能解释一下这些的用法吗?更具体地说,我编写了一个查询来获取关于某个主题的帖子。查询结果将被分页。下面的查询工作正常,并给出了结果

@Query("start post=node:__types__(className='com.xxx.entity.Post'), topic=node({0}) match post-[:TOPIC_POST]-topic return post")
Page<Post> getPostsByTopic(Topic topic, Pageable page);
@Query(“start post=node:\uuuuu types\uuuuu(className='com.xxx.entity.post'),topic=node({0})match post-[:topic\u post]-topic return post”)
页面getPostsByTopic(主题,可分页页面);

现在,我还需要结果的总数,我是否需要为此编写另一个查询,或者是否有办法在其中容纳计数查询?

我认为计数查询应该适合您,但您仍然需要编写计数查询

如果要求分页结果返回正确的总计数, @Query注释可以与中的计数查询一起提供 countQuery属性。此查询在 结果查询及其结果用于填充totalCount 返回页的属性


好的,我试试看。知道countQueryName/queryName是如何使用的吗?它们都是对存储在属性文件中的外部查询的引用。有关更多信息,请参阅我发布的链接中的20.8.4节。谢谢,这很有效。我之前已经阅读了文档,但不知怎的错过了这一部分。