当我尝试运行长查询时,我收到此异常:
无法执行查询[400]:\ nHeaders:Array \ n(\ n [Content-Type] => application / json; charset = UTF-8; stream = true \ n [Access-Control-Allow- Origin] => * \ n [Transfer-Encoding] => chunked \ n [Server] => Jetty(9.0.5.v20130815)\ n)\ nBody:Array \ n(\ n [例外] => ; StackOverflowError \ n [fullname] => java.lang.StackOverflowError \ n [stacktrace] =>数组\ n(\ n [0] => org.neo4j.cypher.internal.compiler.v2_1.bottomUp $ BottomUpRewriter .apply(Rewritable.scala:137)\ n [1] => org.neo4j.cypher.internal.compiler.v2_1.bottomUp $ BottomUpRewriter $$ anonfun $ 1.apply(Rewritable.scala:137)\ n [2] => scala.collection.Iterator $$ anon $ 11.next(Iterator.scala:328)\ n [3] => scala.collection.Iterator $ class.foreach(Iterator.scala:727)\ n [4] => scala.collection.AbstractIterator.foreach(Iterator.scala:1157)\ n [5] => scala.collection.generic.Growable $ class。$ plus $ plus $ eq(Growable.scala:48)\ n [6] => scala.collection.mutable.ListBuffer。$ plus $ plus $ eq(ListBuffer.scala:176)\ n [7] => scala.collection.mutable.ListBuffer。$ plus $ plus $ eq(ListBuffer.scala:45)\ n [8] => scala.collection.TraversableOnce $ class.to(TraversableOnce.scala:273)\ n [9] => scala.collection.AbstractIterator.to(Iterator.scala:1157)\ n [10] => scala.collection.TraversableOnce $ class.toList(TraversableOnce.scala:257)\ n [11] => scala.collection.AbstractIterator.toList(Iterator.scala:1157)\ n [12] => org.neo4j.cypher.internal.compiler.v2_1.bottomUp $ BottomUpRewriter.apply(Rewritable.scala:137)\ n [13] => org.neo4j.cypher.internal.compiler.v2_1.bottomUp $ BottomUpRewriter $$ anonfun $ 1.apply(Rewritable.scala:137)\ n [14] => scala.collection.Iterator $$ anon $ 11.next(Iterator.scala:328)\ n [15] => scala.collection.Iterator $ class.foreach(Iterator.scala:727)\ n [16] => scala.collection.AbstractIterator.foreach(Iterator.scala:1157)\ n [17] => scala.collection.generic.Growable $ class。$ plus $ plus $ eq(Growable.scala:48)\ n [18] => scala.collection.mutable.ListBuffer。$ plus $ plus $ eq(ListBuffer.scala:176)\ n [19] => scala.collection.mutable.ListBuffer。$ plus $ plus $ eq(ListBuffer.scala:45)\ n [20] => scala.collection.TraversableOnce $ class.to(TraversableOnce.scala:273)\ n [21] => scala.collection.AbstractIterator.to(Iterator.scala:1157)\ n [22] => scala.collection.TraversableOnce $ class.toList(TraversableOnce.scala:257)\ n [23] => scala.collection.AbstractIterator.toList(Iterator.scala:1157)\ n [24] => org.neo4j.cypher.internal.compiler.v2_1.bottomUp $ BottomUpRewriter.apply(Rewritable.scala:137)\ n [25] => org.neo4j.cypher.internal.compiler.v2_1.bottomUp $ BottomUpRewriter $$ anonfun $ 1.apply(Rewritable.scala:137)\ n [26] => scala.collection.Iterator $$ anon $ 11.next(Iterator.scala:328)\ n [27] => scala.collection.Iterator $ class.foreach(Iterator.scala:727)\ n [28] => scala.collection.AbstractIterator.foreach(Iterator.scala:1157)\ n [29] => scala.collection.generic.Growable $ class。$ plus $ plus $ eq(Growable.scala:48)\ n [30] => scala.collection.mutable.ListBuffer。$ plus $ plus $ eq(ListBuffer.scala:176)\ n [31] => scala.collection.mutable.ListBuffer。$ plus $ plus $ eq(ListBuffer.scala:45)\ n [32] => scala.collection.TraversableOnce $ class.to(TraversableOnce.scala:273)\ n [33] => scala.collection.AbstractIterator.to(Iterator.scala:1157)\ n [34] => scala.collection.TraversableOnce $ class.toList(TraversableOnce.scala:257)\ n [35] => scala.collection.AbstractIterator.toList(Iterator.scala:1157)\ n [36] => org.neo4j.cypher.internal.compiler.v2_1.bottomUp $ BottomUpRewriter.apply(Rewritable.scala:137)\ n [37] => org.neo4j.cypher.internal.compiler.v2_1.bottomUp $ BottomUpRewriter $$ anonfun $ 1.apply(Rewritable.scala:137)\ n [38] => scala.collection.Iterator $$ anon $ 11.next(Iterator.scala:328)\ n [39] => scala.collection.Iterator $ class.foreach(Iterator.scala:727)\ n [40] => scala.collection.AbstractIterator.foreach(Iterator.scala:1157)\ n [41] => scala.collection.generic.Growable $ class。$ plus $ plus $ eq(Growable.scala:48)\ n [42] => scala.collection.mutable.ListBuffer。$ plus $ plus $ eq(ListBuffer.scala:176)\ n [43] => scala.collection.mutable.ListBuffer。$ plus $ plus $ eq(ListBuffer.scala:45)\ n [44] => scala.collection.TraversableOnce $ class.to(TraversableOnce.scala:273)\ n [45] => scala.collection.AbstractIterator.to(Iterator.scala:1157)\ n [46] => scala.collection.TraversableOnce $ class.toList(TraversableOnce.scala:257)\ n [47] => scala.collection.AbstractIterator.toList(Iterator.scala:1157)\ n [48] => org.neo4j.cypher.internal.compiler.v2_1.bottomUp $ BottomUpRewriter.apply(Rewritable.scala:137)\ n [49] => org.neo4j.cypher.internal.compiler.v2_1.bottomUp $ BottomUpRewriter $$ anonfun $ 1.apply(Rewritable.scala:137)\ n [50] => scala.collection.Iterator $$ anon $ 11.next(Iterator.scala:328)\ n [51] => scala.collection.Iterator $ class.foreach(Iterator.scala:727)\ n [52] => scala.collection.AbstractIterator.foreach(Iterator.scala:1157)\ n [53] => scala.collection.generic.Growable $ class。$ plus $ plus $ eq(Growable.scala:48)\ n [54] => scala.collection.mutable.ListBuffer。$ plus $ plus $ eq(ListBuffer.scala:176)\ n [55] => scala.collection.mutable.ListBuffer。$ plus $ plus $ eq(ListBuffer.scala:45)\ n [56] => scala.collection.TraversableOnce $ class.to(TraversableOnce.scala:273)\ n [57] => scala.collection.AbstractIterator.to(Iterator.scala:1157)\ n [58] => scala.collection.TraversableOnce $ class.toList(TraversableOnce.scala:257)\ n [59] => scala.collection.AbstractIterator.toList(Iterator.scala:1157)\ n [60] => org.neo4j.cypher.internal.compiler.v2_1.bottomUp $ BottomUpRewriter.apply(Rewritable.scala:137)\ n [61] => org.neo4j.cypher.internal.compiler.v2_1.bottomUp $ BottomUpRewriter $$ anonfun $ 1.apply(Rewritable.scala:137)\ n [62] => scala.collection.Iterator $$ anon $ 11.next(Iterator.scala:328)\ n [63] => scala.collection.Iterator $ class.foreach(Iterator.scala:727)\ n [64] => scala.collection.AbstractIterator.foreach(Iterator.scala:1157)\ n [65] => scala.collection.generic.Growable $ class。$ plus $ plus $ eq(Growable.scala:48)\ n [66] => scala.collection.mutable.ListBuffer。$ plus $ plus $ eq(ListBuffer.scala:176)\ n [67] => scala.collection.mutable.ListBuffer。$ plus $ plus $ eq(ListBuffer.scala:45)\ n [68] => scala.collection.TraversableOnce $ class.to(TraversableOnce.scala:273)\ n [69] => scala.collection.AbstractIterator.to(Iterator.scala:1157)\ n [70] => scala.collection.TraversableOnce $ class.toList(TraversableOnce.scala:257)\ n [71] => scala.collection.AbstractIterator.toList(Iterator.scala:1157)\ n [72] => org.neo4j.cypher.internal.compiler.v2_1.bottomUp $ BottomUpRewriter.apply(Rewritable.scala:137)\ n [73] => org.neo4j.cypher.internal.compiler.v2_1.bottomUp $ BottomUpRewriter $$ anonfun $ 1.apply(Rewritable.scala:137)\ n [74] => scala.collection.Iterator $$ anon $ 11.next(Iterator.scala:328)\ n [75] => scala.collection.Iterator $ class.foreach(Iterator.scala:727)\ n [76] => scala.collection.AbstractIterator.foreach(Iterator.scala:1157)\ n [77] => scala.collection.generic.Growable $ class。$ plus $ plus $ eq(Growable.scala:48)\ n [78] => scala.collection.mutable.ListBuffer。$ plus $ plus $ eq(ListBuffer.scala:176)\ n [79] => scala.collection.mutable.ListBuffer。$ plus $ plus $ eq(ListBuffer.scala:45)\ n [80] => scala.collection.TraversableOnce $ class.to(TraversableOnce.scala:273)\ n [81] => scala.collection.AbstractIterator.to(Iterator.scala:1157)\ n [82] => scala.collection.TraversableOnce $ class.toList(TraversableOnce.scala:257)\ n [83] =>财政
查询:
start k = node:node_auto_index(" title:abc *")其中[123,456,...]中的k.id返回不同的k.prop;
上面有大约3000个ID列表。 我正在使用neo4j-community-2.1.2和neo4jphp。这有什么工作吗?
答案 0 :(得分:1)
如果将JVM设置调整为数据,则可能会修复溢出问题。 This page特别处理它,但整个"配置和性能"对于任何使用Neo4j的人来说,设置都是至关重要的。
但考虑到这一点,我会尽量避免这样的查询。事实上,这种类型的索引被称为" legacy"应该是一个警告,一般来说,如果有更好的选择,我发现最好完全避免它。就我所读到的所有内容而言,遗留索引不会让您利用标签,因此您错过了Neo4j 2.0 +最有用的方面之一。
该星号的存在表明您希望对索引进行全文搜索。传统索引是本机执行此操作的唯一方法,但妥协是这样的大规模查询。暂时忽略索引,如果您没有使用旧索引,您可以看到如何执行此操作。由于有很多节点都有共同点,你可以在它们上面放一个标签,然后搜索标签。这就像这样容易:
MATCH (n:`MyLabel`) WHERE n.name =~ "abc*" return n
即使MyLabel:name
上有索引,正则表达式搜索也会跳过它并在Cypher中执行,但它更容易阅读,管理,这是搜索数据库的现代方式
我需要全文搜索时使用的替代方法是Elasticsearch。它使用lucene索引,与Neo4j相同。我在评论https://github.com/sksamuel/elasticsearch-river-neo4j中链接的插件将索引数据库中给定标签的属性。您可以搜索它,它将返回匹配的节点。这样做的缺点是它的额外管道,我不确定它的效率如何 - 它说它会更新数据库的每一个节点上的所有节点,这看起来并不好但是它是一个开始,我确信它可以改进 - 但你有一个好处,就是不要使用过时的功能或笨重的查询来获取你需要的信息。我看到您正在使用PHP,因此您可以编写一个脚本,在应用程序级别更有效地处理它。
TL; DR:调整服务器以修复崩溃;修复您的查询和索引以简化代码。