Implement variable score on spatial queries

Description

Today we use constant score, ie in = 1, out = 0. We can think about a score that goes from 1 to 0 based on the distance from the center to the circle size
We can imagine queries that should return close elements above far elements.
We might need a score going from 1 to .5 or some other value. Need to think about that.

Note that we can launch without this feature initially. That's why it's not a subtask of

depends on

Activity

Show:

Yoann Rodière February 1, 2022 at 12:55 PM

In Hibernate Search 6, distance queries are implemented using `LatLonPointDistanceQuery`, a built-in Lucene class. That class uses constant scores, and I don't think it would be worthwhile to send a PR to Lucene for this.

Closing.

Emmanuel Bernard May 25, 2013 at 2:55 PM

Nice, that looks quite simple

I think constant score should be the default but that the DSL should offer you a way to linearly degrade the score by a factor between center and edge. Now the name is going to be interesting to find.

.lowerScoreWithDistanceUpTo(.5f)

Nicolas Helleringer May 21, 2013 at 2:51 PM

I found a way around>

Check this commit https://github.com/nicolashelleringer/hibernate-search/commit/bc19ea6379c03ccb656bebf051a6272f19c0036c
This should be quite stable through 4.x migration

If it is ok with you I shall bind better on demand variable score activation in DSL

Sanne, Emmanuel ?

Nicolas Helleringer May 20, 2013 at 2:35 PM

Sanne Grinovero May 20, 2013 at 2:28 PM

It is possible that several Queries are more efficient with Lucene 4.x but it's worth keeping in mind that all "native" queries in Lucene are no more than a Java-coded Collector. Just saying that whatever you expect to do in a native query can be done in Search as well coding a custom Collector.

The API in Lucene 4 changes a bit, so it is correct to say that it might be worth doing the migration first and exploring more custom collectors later.

Implementation - wise I would expect you to run the filtering first, so to exclude all results out of range, and only then apply custom scoring on the results.

Won't Do

Details

Assignee

Reporter

Components

Priority

Created December 21, 2011 at 3:51 PM
Updated February 1, 2022 at 12:55 PM
Resolved February 1, 2022 at 12:55 PM