Mailing List Archive

Change score with distance SortField
Hi,
I would like to influence the score using geographical distance. More distant documents lower the score.
I have sort field:
SortField geoSort = LatLonDocValuesField.newDistanceSort("location", pos.getLatitude(), pos.getLongitude());

Then I tried add this sort field to SimpleBindings. I've found some code, where SortField is added to SimpleBindings, but
lucene 9.4.x API doesn't have this capability.

What is the proper way to do this?

thank you, Michal Hlavac



---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Change score with distance SortField [ In reply to ]
Hi Michal,

The best way to do this would be to put a
LatLonPoint#newDistanceFeatureQuery in a SHOULD clause. It's not as
flexible as leveraging expressions, but it has the benefit of not
disabling dynamic pruning.

On Mon, Feb 6, 2023 at 10:33 AM Michal Hlavac <miso@hlavki.eu> wrote:
>
> Hi,
> I would like to influence the score using geographical distance. More distant documents lower the score.
> I have sort field:
> SortField geoSort = LatLonDocValuesField.newDistanceSort("location", pos.getLatitude(), pos.getLongitude());
>
> Then I tried add this sort field to SimpleBindings. I've found some code, where SortField is added to SimpleBindings, but
> lucene 9.4.x API doesn't have this capability.
>
> What is the proper way to do this?
>
> thank you, Michal Hlavac
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>


--
Adrien

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