I like it. You would think it would be easy to get the values from a multiValue field in the geodist() function, but I guess it was not built for that. If anyone has done something similar, let me know. Thanks.
Bill On Thu, Feb 3, 2011 at 3:18 PM, Geert-Jan Brits <gbr...@gmail.com> wrote: > I don't have a direct answer to your question, but you could consider having > fields: > latCombined and LongCombined where you pairwise combine the latitudes and > longitudes, e.g: > > latCombined: 48.00000-49.00000-50.00000 > longcombined: 2.00000-3.00000-4.00000 > > Than in your custom scorer above split latCombined and longcombined and > calculate the closests distance to the user-defined point. > > hth, > Geert-Jan > > 2011/2/3 William Bell <billnb...@gmail.com> > >> Thoughts? >> >> On Wed, Feb 2, 2011 at 10:38 PM, Bill Bell <billnb...@gmail.com> wrote: >> > >> > This is posted as an enhancement on SOLR-2345. >> > >> > I am willing to work on it. But I am stuck. I would like to loop through >> > the lat/long values when they are stored in a multiValue list. But it >> > appears that I cannot figure out to do that. For example: >> > >> > 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/HaversineConstFunction.ja >> > va >> > Has code similar to: >> > 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. The getSources() only >> > returns the following: >> > sources:[double(store_0_coordinate), double(store_1_coordinate)] >> > How do I just get the 4 values in the function? >> > >> > >> > >> >