1

以下是我们的按 ID 查找服务的密码:

START n=node:PATIENTS('MEMBER_PLAN_ID:(1 2)') return n

其中 1 2 是传递的 ID。当我们传递大约 2000 个 id 时,会发生以下错误:

java.lang.RuntimeException: org.apache.lucene.queryParser.ParseException: Cannot parse 'MEMBER_PLAN_ID:(1 2)': too many boolean clauses
        at org.neo4j.index.impl.lucene.IndexType.query(IndexType.java:304)
        at org.neo4j.index.impl.lucene.LuceneIndex.query(LuceneIndex.java:227)
        at org.neo4j.index.impl.lucene.LuceneIndex.query(LuceneIndex.java:238)
        at org.neo4j.cypher.internal.spi.gdsimpl.GDSBackedQueryContext$$anon$1.indexQuery(GDSBackedQueryContext.scala:87)
        at org.neo4j.cypher.internal.executionplan.builders.IndexQueryBuilder$$anonfun$getNodeGetter$2.apply(IndexQueryBuilder.scala:83)
        at org.neo4j.cypher.internal.executionplan.builders.IndexQueryBuilder$$anonfun$getNodeGetter$2.apply(IndexQueryBuilder.scala:81)
        at org.neo4j.cypher.internal.pipes.StartPipe$$anonfun$internalCreateResults$1.apply(StartPipe.scala:36)
        at org.neo4j.cypher.internal.pipes.StartPipe$$anonfun$internalCreateResults$1.apply(StartPipe.scala:35)
        at scala.collection.Iterator$$anon$13.__AW_hasNext(Iterator.scala:371)
        at scala.collection.Iterator$$anon$13.hasNext(Iterator.scala)
        at org.neo4j.cypher.internal.ClosingIterator$$anonfun$hasNext$1.apply$mcZ$sp(ClosingIterator.scala:36)
        at org.neo4j.cypher.internal.ClosingIterator$$anonfun$hasNext$1.apply(ClosingIterator.scala:35)
        at org.neo4j.cypher.internal.ClosingIterator$$anonfun$hasNext$1.apply(ClosingIterator.scala:35)
        at org.neo4j.cypher.internal.ClosingIterator.failIfThrows(ClosingIterator.scala:86)
        at org.neo4j.cypher.internal.ClosingIterator.hasNext(ClosingIterator.scala:35)
        at org.neo4j.cypher.PipeExecutionResult.hasNext(PipeExecutionResult.scala:157)
        at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327)
        at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327)
        at scala.collection.convert.Wrappers$IteratorWrapper.hasNext(Wrappers.scala:29)
        at org.neo4j.cypher.PipeExecutionResult$$anon$1.hasNext(PipeExecutionResult.scala:73)
        at net.ahm.graph.dao.PatientDAO.__AW_findPatients(PatientDAO.java:376)


Caused by: org.apache.lucene.queryParser.ParseException: Cannot parse 'MEMBER_PLAN_ID:(1 2)': too many boolean clauses
        at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:221)
        at org.neo4j.index.impl.lucene.IndexType.query(IndexType.java:300)
        ... 38 more
Caused by: org.apache.lucene.search.BooleanQuery$TooManyClauses: maxClauseCount is set to 1024
        at org.apache.lucene.search.BooleanQuery.add(BooleanQuery.java:136)
        at org.apache.lucene.queryParser.QueryParser.getBooleanQuery(QueryParser.java:958)
        at org.apache.lucene.queryParser.QueryParser.getBooleanQuery(QueryParser.java:933)
        at org.apache.lucene.queryParser.QueryParser.Query(QueryParser.java:1281)
        at org.apache.lucene.queryParser.QueryParser.Clause(QueryParser.java:1323)
        at org.apache.lucene.queryParser.QueryParser.Query(QueryParser.java:1245)
        at org.apache.lucene.queryParser.QueryParser.TopLevelQuery(QueryParser.java:1234)
        at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:206)
        ... 39 more

我们在堆栈跟踪中看到:maxClauseCount 设置为 1024

有没有办法在使用 Cypher 时从 Neo4j 配置这个限制?

4

2 回答 2

3

但是,如果我将此行添加到我们的服务中,则一切正常:

BooleanQuery.setMaxClauseCount(20000);

我们做了一些负载测试,其中 1000 个并发用户使用每个 10,000 个 id 访问服务。之后没有看到服务崩溃/任何意外的性能问题。

于 2013-09-08T02:11:00.530 回答
-1

试试这个(未经测试):

System.setProperty("org.apache.lucene.maxClauseCount", "3000");
于 2013-09-07T20:09:46.837 回答