我正在使用neo4j索引来进行博客的全文搜索,因为findAllByQuery()存储库方法不适用于分页。我试图在密码中使用(跳过/限制)来实现这一点。春季数据neo4j索引搜索
@Query("START blog=node:blogSearch({0}) RETURN blog ORDER BY blog.createDate DESC SKIP {1} LIMIT {2}")
Iterable<BlogGraph> findBlogsByQuery(String luceneExpression, int start, int offset);
参数:luceneExpression: “标题:富”
但我遇到的一些问题。
1,以下例外情况下,第一次调用方法时findBlogsByQuery。显然,索引“blogSearch”尚未创建,但如何创建?如果我使用findAllByQuery()库方法,当第一次我把它从文档的索引将创建:http://docs.spring.io/spring-data/neo4j/docs/2.0.0.RELEASE/reference/html/#d0e2031
Error executing statement START blog=node:blogSearch({0}) RETURN blog ORDER BY
blog.createDate DESC SKIP {1} LIMIT {2}; nested exception is
org.springframework.dao.InvalidDataAccessResourceUsageException: Error executing
statement START blog=node:blogSearch({0}) RETURN blog ORDER BY blog.createDate
DESC SKIP {1} LIMIT {2}; nested exception is org.neo4j.cypher.MissingIndexException:
Index `blogSearch` does not exist
2,假设指数“博客搜索”已经被创建,另一个问题(NullPointException )出来,如果搜索文本包括空间,如下图所示:
参数:luceneExpression:“标题:富富”
但我不看到这种情况发生时,使用findAllByQuery()库方法
BlogGraph.java
@NodeEntity
public class BlogGraph {
@GraphId Long id;
@Indexed
long blogId;
@Indexed(indexName="blogSearch", indexType = IndexType.FULLTEXT)
String title;
...
任何帮助,将不胜感激。
在此状态有任何更新? –