How does geohash index work in Lucene

后端 未结 1 1553
情话喂你
情话喂你 2021-02-11 05:15

In lucene spatial 4 I\'m wondering how the geohash index works behind the scenes. I understand the concept of the geohash which basically takes 2 points (lat, lon) and creates

相关标签:
1条回答
  • 2021-02-11 06:04

    The best online explanation is my video: Lucene / Solr 4 Spatial deep dive

    Is the index just a "string" index (r-tree or quad-tree) or something along these lines (such as just indexing a last name).....or is there something special with it.

    Lucene, fundamentally, has just one index used for text, numbers, and now spatial. You could say it's a string index. It's a sorted list of bytes/strings. From a higher level view, using spatial in this way is the family of "Tries" AKA "PrefixTrees" in computer science.

    For pre-fixed type searches do all of the n-grams of the hash get indexed such as if a geohash is

    drgt2abc does this get indexed as d, dr, drg, drgt, etc..

    Yes.

    Is there a default number of n-grams that we might want indexed?

    You tell it conveniently in terms of the precision requirements you have and it'll lookup how long it needs to be. Or you can tell it by length.

    With this type of indexing will search queries with 100 thousand records verse 100 million records have similar query performance for spatial queries. (Such as box/polygon, or distance) or can I expect a general/typical slow degradation of the index as lots of records added.

    Indeed, this type of indexing (and more specifically the clever recursive search tree algorithm that uses it) means that you'll have scalable search performance. 100m is a ton of documents for one filter to match so it's of course going to be slower than one that matches only 100k docs, but it's definitely sub-linear. And by next year it'll be even faster, due to work happening this summer on a new PrefixTree encoding plus a spatial benchmark in progress which will allow me to make further tuning optimizations I have planned.

    0 讨论(0)
提交回复
热议问题