Neo4j manual/explicit indexes and non-string range queries

时光总嘲笑我的痴心妄想 提交于 2019-12-24 14:06:12

问题


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.

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

For example:

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

that is obviously not the something that was expected.

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


回答1:


If you read the docs, it says

'Sorting is done lexicographically'

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

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



来源:https://stackoverflow.com/questions/50545551/neo4j-manual-explicit-indexes-and-non-string-range-queries

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!