Correctly indexing latitude and longitude values in Lucene

只愿长相守 提交于 2019-12-03 08:19:26

Here's the bleeding edge about Searching Numerical Fields in Lucene by Uwe Schindler, the expert on the subject. You may need to use the older (and slower) ConstantScoreRangeQuery because Lucene.net is a bit behind Lucene, and the class NumericRangeQuery described in the link was not yet released in Java Lucene.

itsadok

The linked article in Yuval F's answer made me realize I was wrong in an earlier answer, which you seem to be relying on.

You shouldn't index negative numbers as is, especially in this case, where some of the values are negative and some are positive.

This article seems to have a pretty good discussion of spatial search. He uses some transformations to make all the values positive, and he also touches on other subjects you should probably be aware of, like distance calculations.

One thing to remember if you're encoding the values is to encode them both for the indexing and when building the query.

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