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

Ignacio Vera commented on LUCENE-8482:
--------------------------------------

 

I think I am doing already that, iterating through all values and choosing the 
one with smaller distance. I have rewriten the method for clarity:

 
{code:java}
private long selectValue(SortedNumericDocValues multiDocValues) throws 
IOException {
  int count = multiDocValues.docValueCount();
  long value = multiDocValues.nextValue();
  if (count == 1) {
    return value;
  }
  // compute exact sort key: avoid any asin() computations
  double distance = getDistanceKeyFromEncoded(value);
  for (int i = 1; i < count; ++i) {
    long nextValue = multiDocValues.nextValue();
    double nextDistance = getDistanceKeyFromEncoded(nextValue);
    if (nextDistance < distance) {
      distance = nextDistance;
      value = nextValue;
    }
  }
  return value;
}{code}
 

I will play with making the IntersectVisitor less restrictive to see how much 
it helps.

 

> Boosting by geo distance
> ------------------------
>
>                 Key: LUCENE-8482
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8482
>             Project: Lucene - Core
>          Issue Type: New Feature
>            Reporter: Adrien Grand
>            Priority: Minor
>         Attachments: LUCENE-8482.patch
>
>
> Similarly to LUCENE-8340 it would be nice to have an easy and efficient way 
> to fold geo distance into scoring formulas in order to boost by proximity.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to