[ 
https://issues.apache.org/jira/browse/LUCENE-4208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13453692#comment-13453692
 ] 

David Smiley commented on LUCENE-4208:
--------------------------------------

This being said, something relatively simple should be done to advance this 
issue for v4 (and I'll do the work now).  It comes down to what is the score of 
makeQuery()?  The strategies are doing different things right now.  Here are 3 
options I can think of:
# Standardize on the reciprocal distance using some specific formula like 
c/(d+c) where c is 1/10th the distance to the nearest query shape edge.
# Documented loosely to allow any "reasonable" shape similarity so that it will 
at least sort sensibly (this precludes returning the distance directly).
# Add a ValueSource parameter to makeQuery(). This allows the caller to pick 
something.  If null is supplied then you get a ConstantScoreQuery.  A 
convenience method on Strategy can be provided to return a ValueSource of the 
reciprocal distance formula if the caller wants to use that.

The #3 the ValueSource parameter seems appealing to me but then I remember why 
makeQuery() exists instead of letting the user combine the distance valueSource 
& makeFilter.  If the filter requires the valueSource (such as a [working] 
TwoDoubles given a query shape other than a rect), then the valueSource might 
be invoked twice: first for matching and second for the score.  One idea to 
alter option #3 is to make the argument an implementation of a single-method 
interface that accepts the distance valueSource and returns a valueSource for 
the score.
                
> Spatial distance relevancy should use score of 1/distance
> ---------------------------------------------------------
>
>                 Key: LUCENE-4208
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4208
>             Project: Lucene - Core
>          Issue Type: New Feature
>          Components: modules/spatial
>            Reporter: David Smiley
>             Fix For: 4.0
>
>
> The SpatialStrategy.makeQuery() at the moment uses the distance as the score 
> (although some strategies -- TwoDoubles if I recall might not do anything 
> which would be a bug).  The distance is a poor value to use as the score 
> because the score should be related to relevancy, and the distance itself is 
> inversely related to that.  A score of 1/distance would be nice.  Another 
> alternative is earthCircumference/2 - distance, although I like 1/distance 
> better.  Maybe use a different constant than 1.
> Credit: this is Chris Male's idea.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to