lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Smiley (JIRA)" <>
Subject [jira] Commented: (SOLR-2155) Geospatial search using geohash prefixes
Date Sun, 13 Feb 2011 17:22:57 GMT


David Smiley commented on SOLR-2155:

There is no committer assigned, as you can see. After sorting (less so polygon), I suspect
it'll do enough to get enough committer interest. 

1. Sorting without a geo filter does present a challenge; this is something I've been thinking
about. However, haversine is only evaluated for each matching result. If there aren't many,
then it isn't too bad. If there are many, then the only thing I can think of would be to try
and only get the distance for points in a geo-hash box filter at the query center, assuming
you're only looking at the top-10 results. If there aren't enough results in the box to fill
the top-10 then you could either recursively expand the geo-hash box or give-up on being smart
and traverse the remaining matched documents. Figuring out how to guess a suitable initial
box size might be tricky.
2. My latest geohash field indexes at every intermediate resolution. So if you were looking
through the index values looking for the actual full-detail points, you'd need to filter out
those that aren't long enough.
3. You're only getting one value out of the field cache because each term/geohash (i.e. point)
is a separate value. I confess to not having coded with the field cache and value sources
yet.  It has first class support for single-value per document but multi-value was added later
and I don't yet know what's involved.

> Geospatial search using geohash prefixes
> ----------------------------------------
>                 Key: SOLR-2155
>                 URL:
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: David Smiley
>         Attachments: GeoHashPrefixFilter.patch, GeoHashPrefixFilter.patch, GeoHashPrefixFilter.patch,
> There currently isn't a solution in Solr for doing geospatial filtering on documents
that have a variable number of points.  This scenario occurs when there is location extraction
(i.e. via a "gazateer") occurring on free text.  None, one, or many geospatial locations might
be extracted from any given document and users want to limit their search results to those
occurring in a user-specified area.
> I've implemented this by furthering the GeoHash based work in Lucene/Solr with a geohash
prefix based filter.  A geohash refers to a lat-lon box on the earth.  Each successive character
added further subdivides the box into a 4x8 (or 8x4 depending on the even/odd length of the
geohash) grid.  The first step in this scheme is figuring out which geohash grid squares cover
the user's search query.  I've added various extra methods to GeoHashUtils (and added tests)
to assist in this purpose.  The next step is an actual Lucene Filter, GeoHashPrefixFilter,
that uses these geohash prefixes in to skip to relevant grid squares in the
index.  Once a matching geohash grid is found, the points therein are compared against the
user's query to see if it matches.  I created an abstraction GeoShape extended by subclasses
named PointDistance... and CartesianBox.... to support different queried shapes so that the
filter need not care about these details.
> This work was presented at LuceneRevolution in Boston on October 8th.

This message is automatically generated by JIRA.
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message