lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <luc...@mikemccandless.com>
Subject Re: Geospatial SortField
Date Tue, 16 Aug 2016 12:41:17 GMT
It's best to switch to LatLonDocValuesField and use its newDistanceSort.
These are new in 6.x, and in 6.2 there are some nice improvements.

Mike McCandless

http://blog.mikemccandless.com

On Tue, Aug 16, 2016 at 6:00 AM, Rolf Veen <rolf.veen@gmail.com> wrote:

> Hi, all.
>
> I had a piece of code to create a 'near' SoftField like this:
>
> public SortField distanceSortField(double x, double y, IndexSearcher ix)
> throws Exception {
>   Point pt = ctx.makePoint(x, y);
>   ValueSource valueSource = strategy.makeDistanceValueSource(pt,
> DistanceUtils.DEG_TO_KM);
>   return valueSource.getSortField(false);
> }
>
>
> This does not work anymore due to refactoring in Lucene 6 and Spatial libs.
> What would be the current approach to build a 'near' SortField in Lucene
> 6.x, based on a GeoPointField ?
>
> Kind regards,
> Rolf.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message