lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guillermo Payet <>
Subject Re: geographical searches
Date Tue, 03 May 2005 15:52:31 GMT
> Your goal is to restrict documents search results to spatial extends
> similar to the syntax which restricts documents based on their
> (creation/modification) date within a given time period.

Yes...  That's the immediate goal, which I have already achieved
by using quadTrees and the GeoFilter class I pasted here.  This is
already live (since yesterday).  To see it in action, go to:

It's a little bit of a hack though, and needs some work before I can
contribute it in any meaningful form to the project.

> For the indexing field descriptions are added to the indexer in order
> to tell him, which fields to index and which store. You now want to
> add a new type, let's call it coordinates (WGS84) as a new field type
> to index. For Lucene API users nothing changes from here on for the
> index.

I haven't studied the structure of the Lucene index yet. (which I'll 
do) so I don't really know how to approach this. It makes sense
to add a new "Coordinates" Field type to documents, but I suspect 
that the spatial indexing (using a quadTree in my implementation) 
needs to be done outside of Lucene's regular indexing.

> Now, in a search, a bounding box is given as two WGS84 coordinates (=
> lat/lon numbers north/west and lat/lon numbers south east) being a
> syntax extension.

That's right.  Additional search formats would ba a central point plus 
a radius, or just a central point, returning all documents ranked by 
proximity to the point.  Maybe this last one should be done as a Sort 

> Based on the location value (if any) of each hit a result set comes
> out which is a subset of all hits if there was no spatial filter
> (don't now how you handle hits which have no lat/lon location value?).

In my project, all items have locations.  For a more generic implementation,
yes, that has to be thought through.

As I said, the problem has pretty much been solved now.  I'm just using 
the GeoFilter I wrote (and posted here).  I would like to reimplement it 
in some "clean way" so that it can be rolled into the project.


Guillermo Payet
L O C A L  H A R V E S T

Every Morning I awake torn between a desire to save the world and 
an inclination to savor it.  This makes it hard to plan the day.


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

View raw message