Neo4j:SDN4中的Lucene查询语法
有人能解释一下适当的Cypher查询语法,从下面提到的存储库查询中得到以下结果吗?下面提到的团队名称已保存到存储库中Neo4j:SDN4中的Lucene查询语法,neo4j,lucene,cypher,spring-data-neo4j,spring-data-neo4j-4,Neo4j,Lucene,Cypher,Spring Data Neo4j,Spring Data Neo4j 4,有人能解释一下适当的Cypher查询语法,从下面提到的存储库查询中得到以下结果吗?下面提到的团队名称已保存到存储库中 洛杉矶湖人队 洛杉矶阿纳海姆快船队 金州勇士队 阿纳海姆的洛杉矶打手 洛杉矶阿纳海姆拖鞋 我被建议使用下面的密码,它最终会出现在NPE中。 NullPointerException: Exception in thread "main" java.lang.IllegalStateException: Failed to execute CommandLineRunner
- 洛杉矶湖人队
- 洛杉矶阿纳海姆快船队
- 金州勇士队
- 阿纳海姆的洛杉矶打手
- 洛杉矶阿纳海姆拖鞋
Exception in thread "main" java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.runCommandLineRunners(SpringApplication.java:675)
at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:690)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:957)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:946)
at com.directv.service.Sports.main(Sports.java:134)
Caused by: java.lang.NullPointerException
at org.apache.lucene.util.SimpleStringInterner.intern(SimpleStringInterner.java:54)
at org.apache.lucene.util.StringHelper.intern(StringHelper.java:39)
at org.apache.lucene.index.Term.<init>(Term.java:38)
at org.apache.lucene.queryParser.QueryParser.getFieldQuery(QueryParser.java:643)
线程“main”java.lang.IllegalStateException中的异常:无法执行CommandLineRunner
位于org.springframework.boot.SpringApplication.runCommandLineRunners(SpringApplication.java:675)
位于org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:690)
位于org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
位于org.springframework.boot.SpringApplication.run(SpringApplication.java:957)
位于org.springframework.boot.SpringApplication.run(SpringApplication.java:946)
位于com.directv.service.Sports.main(Sports.java:134)
原因:java.lang.NullPointerException
位于org.apache.lucene.util.SimpleStringInterner.intern(SimpleStringInterner.java:54)
位于org.apache.lucene.util.StringHelper.intern(StringHelper.java:39)
位于org.apache.lucene.index.Term.(Term.java:38)
位于org.apache.lucene.queryParser.queryParser.getFieldQuery(queryParser.java:643)
经过反复尝试,我终于解决了这个问题。正如@Michael Hunger指出的,这是查询中嵌入空格字符的问题。合适的查询是:
@Query(“开始团队=节点:团队名称(*洛杉矶队将进入黄金状态*))返回团队”)
经过一些尝试和错误,我能够解决这个问题。正如@Michael Hunger指出的,这是查询中嵌入空格字符的问题。合适的查询是:
@Query(“START team=node:teamName('teamName:(*洛杉矶队将进入黄金状态*))RETURN team”)
您的查询字符串看起来像是lucene的问题。请确保引用(反斜杠)空格。您可以共享导致此错误的lucene查询字符串吗?@Michael Hunger查询字符串只是纯文本:teamRepository.findByTeamName(“洛杉矶将在黄金状态下比赛”)很遗憾,您必须在那里转义空格。这看起来像是查询字符串的lucene问题。请确保引用(反斜杠)空格。您可以共享导致此错误的lucene查询字符串吗?@Michael Hunger查询字符串只是纯文本:teamRepository.findByTeamName(“洛杉矶将在黄金状态下比赛”)代码>不幸的是,您必须在那里逃出空格。
teamRepository.findByTeamName("The Los Angeles Will be Playing in a state of Golden");
Exception in thread "main" java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.runCommandLineRunners(SpringApplication.java:675)
at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:690)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:957)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:946)
at com.directv.service.Sports.main(Sports.java:134)
Caused by: java.lang.NullPointerException
at org.apache.lucene.util.SimpleStringInterner.intern(SimpleStringInterner.java:54)
at org.apache.lucene.util.StringHelper.intern(StringHelper.java:39)
at org.apache.lucene.index.Term.<init>(Term.java:38)
at org.apache.lucene.queryParser.QueryParser.getFieldQuery(QueryParser.java:643)