Neo4j 可以在通过RESTAPI传递的多索引查找密码查询中使用参数吗?

Neo4j 可以在通过RESTAPI传递的多索引查找密码查询中使用参数吗?,neo4j,Neo4j,我想执行类似以下内容的密码查询: START n=node:myindex('value:"hello" OR value:"world"') return n 使用REST API,类似这样的方法可以工作: POST http://localhost:7474/db/data/cypher {"query" : "start n = node:myindex('value=hello OR value=world') return n"} (从这里开始,我将去掉POST位,刚好超过JSON

我想执行类似以下内容的密码查询:

START n=node:myindex('value:"hello" OR value:"world"') return n
使用REST API,类似这样的方法可以工作:

POST http://localhost:7474/db/data/cypher {"query" : "start n = node:myindex('value=hello OR value=world') return n"}
(从这里开始,我将去掉
POST
位,刚好超过JSON)

我想做的是参数化查询,理想情况下:

{
 "query" : "start n = node:myindex('value={p0} OR value={p1}') return n", 
 "params" : { "p0" : "hello", "p1" : "world"}
}
但这给了我:

400 Bad Request
{
  "exception" : "BadInputException",
  "fullname" : "org.neo4j.server.rest.repr.BadInputException",
  "stacktrace" : [ "org.neo4j.server.rest.repr.RepresentationExceptionHandlingIterable.exceptionOnHasNext(RepresentationExceptionHandlingIterable.java:50)", "org.neo4j.helpers.collection.ExceptionHandlingIterable$1.hasNext(ExceptionHandlingIterable.java:60)", "org.neo4j.helpers.collection.IteratorWrapper.hasNext(IteratorWrapper.java:42)", "org.neo4j.server.rest.repr.ListRepresentation.serialize(ListRepresentation.java:58)", "org.neo4j.server.rest.repr.Serializer.serialize(Serializer.java:75)", "org.neo4j.server.rest.repr.MappingSerializer.putList(MappingSerializer.java:61)", "org.neo4j.server.rest.repr.CypherResultRepresentation.serialize(CypherResultRepresentation.java:57)", "org.neo4j.server.rest.repr.MappingRepresentation.serialize(MappingRepresentation.java:42)", "org.neo4j.server.rest.repr.OutputFormat.assemble(OutputFormat.java:179)", "org.neo4j.server.rest.repr.OutputFormat.formatRepresentation(OutputFormat.java:131)", "org.neo4j.server.rest.repr.OutputFormat.response(OutputFormat.java:117)", "org.neo4j.server.rest.repr.OutputFormat.ok(OutputFormat.java:55)", "org.neo4j.server.rest.web.CypherService.cypher(CypherService.java:95)", "java.lang.reflect.Method.invoke(Unknown Source)" ],
  "cause" : {
    "exception" : "NullPointerException",
    "stacktrace" : [ "org.apache.lucene.util.SimpleStringInterner.intern(SimpleStringInterner.java:54)", "org.apache.lucene.util.StringHelper.intern(StringHelper.java:39)", "org.apache.lucene.index.Term.<init>(Term.java:38)", "org.apache.lucene.queryParser.QueryParser.getFieldQuery(QueryParser.java:643)", "org.apache.lucene.queryParser.QueryParser.Term(QueryParser.java:1436)", "org.apache.lucene.queryParser.QueryParser.Clause(QueryParser.java:1319)", "org.apache.lucene.queryParser.QueryParser.Query(QueryParser.java:1245)", "org.apache.lucene.queryParser.QueryParser.TopLevelQuery(QueryParser.java:1234)", "org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:206)", "org.neo4j.index.impl.lucene.IndexType.query(IndexType.java:300)", "org.neo4j.index.impl.lucene.LuceneIndex.query(LuceneIndex.java:227)", "org.neo4j.index.impl.lucene.LuceneIndex.query(LuceneIndex.java:238)", "org.neo4j.cypher.internal.spi.gdsimpl.GDSBackedQueryContext$$anon$1.indexQuery(GDSBackedQueryContext.scala:87)", "org.neo4j.cypher.internal.executionplan.builders.IndexQueryBuilder$$anonfun$getNodeGetter$2.apply(IndexQueryBuilder.scala:83)", "org.neo4j.cypher.internal.executionplan.builders.IndexQueryBuilder$$anonfun$getNodeGetter$2.apply(IndexQueryBuilder.scala:81)", "org.neo4j.cypher.internal.pipes.StartPipe$$anonfun$internalCreateResults$1.apply(StartPipe.scala:36)", "org.neo4j.cypher.internal.pipes.StartPipe$$anonfun$internalCreateResults$1.apply(StartPipe.scala:35)", "scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:371)", "org.neo4j.cypher.internal.ClosingIterator$$anonfun$hasNext$1.apply$mcZ$sp(ClosingIterator.scala:36)", "org.neo4j.cypher.internal.ClosingIterator$$anonfun$hasNext$1.apply(ClosingIterator.scala:35)", "org.neo4j.cypher.internal.ClosingIterator$$anonfun$hasNext$1.apply(ClosingIterator.scala:35)", "org.neo4j.cypher.internal.ClosingIterator.failIfThrows(ClosingIterator.scala:86)", "org.neo4j.cypher.internal.ClosingIterator.hasNext(ClosingIterator.scala:35)", "org.neo4j.cypher.PipeExecutionResult.hasNext(PipeExecutionResult.scala:133)", "scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327)", "scala.collection.convert.Wrappers$IteratorWrapper.hasNext(Wrappers.scala:29)", "org.neo4j.helpers.collection.ExceptionHandlingIterable$1.hasNext(ExceptionHandlingIterable.java:58)", "org.neo4j.helpers.collection.IteratorWrapper.hasNext(IteratorWrapper.java:42)", "org.neo4j.server.rest.repr.ListRepresentation.serialize(ListRepresentation.java:58)", "org.neo4j.server.rest.repr.Serializer.serialize(Serializer.java:75)", "org.neo4j.server.rest.repr.MappingSerializer.putList(MappingSerializer.java:61)", "org.neo4j.server.rest.repr.CypherResultRepresentation.serialize(CypherResultRepresentation.java:57)", "org.neo4j.server.rest.repr.MappingRepresentation.serialize(MappingRepresentation.java:42)", "org.neo4j.server.rest.repr.OutputFormat.assemble(OutputFormat.java:179)", "org.neo4j.server.rest.repr.OutputFormat.formatRepresentation(OutputFormat.java:131)", "org.neo4j.server.rest.repr.OutputFormat.response(OutputFormat.java:117)", "org.neo4j.server.rest.repr.OutputFormat.ok(OutputFormat.java:55)", "org.neo4j.server.rest.web.CypherService.cypher(CypherService.java:95)", "java.lang.reflect.Method.invoke(Unknown Source)" ],
    "fullname" : "java.lang.NullPointerException"
  }
}

当我返回结果时,我认为问题在于索引查询周围的

不可能对索引查询的部分进行参数化。在这种情况下,您必须使用整个索引查询作为单个参数,正如Thomas在

的第二段中指出的那样,还有一个问题是,这是否适合您的问题?不,因为这是针对单个参数的,效果很好,这是专门针对多个参数的。我明白了,所以要参数化整个查询,感谢您在上下文中指出解决方案——这是一个以假乱真的例子。
{
 "query" : "start n = node:myindex('value=hello OR value=world') return n"
}