本文介绍了Neo4j手动/显式索引和非字符串范围查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够移植Neo4j 3.4.0应用程序以使用手动索引和APOC过程,而不是通过索引关系属性进行查询.除了最后一件事,一切都像魅力一样运作-我遇到了非字符串Lucene范围查询的问题.

I was able to port my Neo4j 3.4.0 application to use manual indexes and APOC procedures instead of queries over the indexles relationship properties. Everything is working like a charm except one last thing - I ran into the issue with non-string Lucene range queries.

它们无法按预期方式运行 Lucene查询语言和数字范围

They are not working as expected Lucene query language and numeric range

例如:

我正在应用以下Lucene查询谓词,以获取2 to 6范围内的所有包含数字:

I'm applying the following Lucene query predicate in order to get all inclusive numbers in 2 to 6 range:

value:[2 TO 6]

并接收具有以下值的文档:

and receive the documents with the following values:

567986400000
567986400000
567986400000
536450400000
536450400000
599608800000
536450400000
567986400000

这显然不是预期的.

Neo4j/APOC中有什么我需要做的才能使其正常工作?

Is there anything in Neo4j/APOC that I can do in order to get it working properly?

推荐答案

如果您阅读文档,则会显示

If you read the docs, it says

排序是按字典顺序进行的"

'Sorting is done lexicographically'

请参见下面的范围查询": https://lucene. apache.org/core/6_4_1/queryparser/org/apache/lucene/queryparser/classic/package-summary.html

See 'Range queries' under:https://lucene.apache.org/core/6_4_1/queryparser/org/apache/lucene/queryparser/classic/package-summary.html

您应该将数据编入例如DoubleDocValuesField而不是StringField/TextField的索引,并使用适当的Lucene查询,例如PointRangeQuery

You should index the data into, for example a DoubleDocValuesField instead of a StringField/TextField and use a appropriate Lucene query, like PointRangeQuery

这篇关于Neo4j手动/显式索引和非字符串范围查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 12:00