lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Bell (JIRA)" <>
Subject [jira] Commented: (SOLR-2345) Extend geodist() to support MultiValuefield for sorting/scoring
Date Fri, 04 Feb 2011 04:33:23 GMT


Bill Bell commented on SOLR-2345:

Here is more info:


I am trying to do:


I want to change geodist() to return id=56 and id=57.

return order:

id=57 {42,-97}
id=56 {42,-97.5}

But when I look at "geodist()", it is only looking at the 2nd
value in the multiValue list. So the result is:

id=56 {42,-97.5}
id=57 {41,-95}
id=58 {40,-95}

So I want the algorithm to be for a function on a multiValue="true" field:

1. The geodist() function should check both distances in the multiValue list, and return the
closest (asc) or farthest (desc) distance computed
2. Then it should sort on the distance that is returned from #1

But when I looked at and debug it, I cannot find a way to get
both ValueSource. It only seems to return the last one.

Basically I need a method like latVals.doubleVal(doc) to return array of lat values for a
document. The Lucene function to get the field "store_0_coordinate" only returns one value
for the multiValue field. 

Once I figure this out, I can see extending all functions to support multiValue fields by
using the #1, #2 above.


> Extend geodist() to support MultiValuefield for sorting/scoring
> ---------------------------------------------------------------
>                 Key: SOLR-2345
>                 URL:
>             Project: Solr
>          Issue Type: New Feature
>            Reporter: Bill Bell
> Extend geodist() and potentially other functions to support MultiValue fields for sorting
and scoring.
> sort=geodist() asc
> This should grab the closest point in the MultiValue list, and return the distance so
that is can be scored.
> The problem is I cannot find a way to get the MultiValue list?
> In function: src/java/org/apache/solr/search/function/distance/
> VectorValueSource p2;
> this.p2 = vs
> List<ValueSource> sources = p2.getSources();
> ValueSource latSource = sources.get(0);                 
> ValueSource lonSource = sources.get(1);                 
> DocValues latVals = latSource.getValues(context1, readerContext1);
> DocValues lonVals = lonSource.getValues(context1, readerContext1);
> double latRad = latVals.doubleVal(doc) * DistanceUtils.DEGREES_TO_RADIANS;
> double lonRad = lonVals.doubleVal(doc) * DistanceUtils.DEGREES_TO_RADIANS;
> etc...
> It would be good if I could loop through sources.get() but it only returns 2 sources
even when there are 2 pairs of lat/long.
> sources:[double(store_0_coordinate), double(store_1_coordinate)]
> How do I extend the sources?

This message is automatically generated by JIRA.
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message