lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pablo Mincz <pmi...@gmail.com>
Subject Re: Lucene 5.3.0 GeoPointDistanceQuery
Date Mon, 21 Sep 2015 18:43:04 GMT
Thanks for the response.

Someone has an example on how to use a FunctionQuery in a
CustomScoreQuery with the haversin function?

Thanks!
Regards,
Pablo.

On Mon, Aug 24, 2015 at 7:40 PM, Uwe Schindler <uwe@thetaphi.de> wrote:
> Hi,
>
> you can use the lucene-expressions module and use the distance function there as part
of the score. In general, just sorting by distance brings bad user experience, because you
would ignore the score completely. So you should just "tune" the score by taking the distance
into account, e.g. newscore = score / distance. And you can do this with expressions, the
formula can be given as Javascript function, see https://lucene.apache.org/core/5_3_0/expressions/index.html
(haversin function is giving distance on earth).
>
> If you want to hardcode the stuff in plain java, you can also use CustomScoreQuery from
the lucene-queries module: https://lucene.apache.org/core/5_3_0/queries/org/apache/lucene/queries/CustomScoreQuery.html
> You can use this query and change the score of the inner query ("subquery") and provide
a CustomScoreProvider or FunctionQuery.
>
> For both solutions you need latitude and longitude as a DocValues field.
>
> Uwe
>
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: uwe@thetaphi.de
>
>
>> -----Original Message-----
>> From: Pablo Mincz [mailto:pmincz@gmail.com]
>> Sent: Monday, August 24, 2015 10:27 PM
>> To: java-user@lucene.apache.org
>> Subject: Lucene 5.3.0 GeoPointDistanceQuery
>>
>> Hi,
>>
>> I'm using GeoPointDistanceQuery to filter the results near by a certain
>> coordinate, but now I want to sort them by distance to that coordinate.
>>
>> I did not find anything in the github repository on how to do this.
>>
>> Someone know how to do this?
>>
>> Thanks for the help!
>>
>> Regards,
>> Pablo.
>>
>> ---------------------------------------------------------------------
>> 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
>

---------------------------------------------------------------------
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