You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Simon Rainer <Ra...@ait.ac.at> on 2015/04/01 19:49:02 UTC
Lucene Spatial: sorg by best fit
Hi,
I'm trying to implement sorting by 'best fit' in Lucene spatial. I.e. I want to query my index for documents that intersect a query rectangle, and get my results sorted by the amount overlap between the query rectangle and the document shape. I was wondering whether this is a use case that has been solved before, but couldn't find anything obvious when googling for it.
I guess I can solve this with a custom FieldComparator? Any hints, pointers to prior work, recommended practices, etc. greatly appreciated!
Thanks,
Rainer
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Lucene Spatial: sorg by best fit
Posted by "david.w.smiley@gmail.com" <da...@gmail.com>.
Hi Rainer,
The BBoxStrategy is pretty close to this. It does assume indexed
rectangles and not other shapes, and it’s limited to one rect value per
field, but perhaps this is fine for you nonetheless? See
the makeOverlapRatioValueSource() method. If this feature was non-obvious,
I think I may need to make this more prominent from the BBoxStrategy class
level javadocs. Did you at least find this strategy?
~ David Smiley
Freelance Apache Lucene/Solr Search Consultant/Developer
http://www.linkedin.com/in/davidwsmiley
On Wed, Apr 1, 2015 at 1:49 PM, Simon Rainer <Ra...@ait.ac.at> wrote:
> Hi,
>
> I'm trying to implement sorting by 'best fit' in Lucene spatial. I.e. I
> want to query my index for documents that intersect a query rectangle, and
> get my results sorted by the amount overlap between the query rectangle and
> the document shape. I was wondering whether this is a use case that has
> been solved before, but couldn't find anything obvious when googling for it.
>
> I guess I can solve this with a custom FieldComparator? Any hints,
> pointers to prior work, recommended practices, etc. greatly appreciated!
>
> Thanks,
> Rainer
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>