lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julian Atkinson <jpa...@gmail.com>
Subject Re: spatial searches
Date Sat, 22 May 2010 06:45:05 GMT
Hi Klaus,

I suggest you take a look at the code in TestCartesian.java for
working examples of the search and as a staring point to trace
through.

in more depth, if you look at DistanceQueryBuilder.java you'll see 2
filters are being setup.

The first pass filter is created by CartesianPolyFilterBuilder and
this makes sure you only consider documents near to the area you are
searching by looking in the right tier and pulling out the relevant
grid cells.

The second filter is dependent on which method you are using Lat/Lng
or Geohash - this is where the more precise filtering is done based on
the calculated distance.

The use of the second pass filter is optional and driven by a boolean.

If you want to custom score then there is an example in the
TestCartesian.class with CustomScoreQuery

Hope this helps,
Julian



On 11 May 2010 15:18, Klaus Malorny <Klaus.Malorny@knipp.de> wrote:
>
> Hi all,
>
> I hope someone can enlighten me. I am trying to figure out how spatial
> searches are to be implemented with Lucene. From walking through mailing
> lists and various web pages, looking at the JavaDoc and source code, I
> understand how the tiers work and how the search is limited by a special
> term query containing the ID(s) of the relevant grid cells.
>
> However, it still puzzles me how, where and when the final distance
> filtering takes place. I see three possibilities: the "Filter" class, the
> "ValueSourceQuery" or the use of a subclass of "Collector". With my limited
> understanding of the inner working of Lucene, it seems to me that the first
> two ways more or less operate on the whole document set, i.e. prior to the
> moment where the term query for the tiers comes into effect, rendering it
> useless. The "Collector" approach seems to be much more appropriate, but
> additionally to the decision whether the document meets the distance
> condition or not, I would like to have different scores depending on the
> distance (lower score for larger distances). Originally I thought that the
> solution would be some kind of subclass of "Query", but haven't seen any
> hints pointing in this direction and I don't know whether I am able to
> implement that on my own. I fear that I completely misunderstand something.
> Thanks in advance for any hints.
>
> Regards,
>
> Klaus
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message