Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
Lucene.Net 2.9.4g
-
Windows 7 x64
Description
The GeoHashFilteredDocIdSet is assuming the values are always in the cache which is wrong. A proposed fix for the method is listed here for GeoHashDistanceFilter.cs:
public GeoHashFilteredDocIdSet(DocIdSet innerSet, string[] geoHashValues, Dictionary<string, double> distanceLookupCache, double lat, double lng, int docBase, double distance, Dictionary<int, double> distances)
: base(innerSet , (docid) => /* was: public override Match */
{
String geoHash = geoHashValues[docid];
double[] coords = GeoHashUtils.Decode(geoHash);
double x = coords[0];
double y = coords[1];
double cachedDistance;
distanceLookupCache.TryGetValue(geoHash, out cachedDistance);
double d;
if (cachedDistance > 0)
{ d = cachedDistance; }else
{ d = DistanceUtils.GetInstance().GetDistanceMi(lat, lng, x, y); distanceLookupCache[geoHash] = d; }if (d < distance)
{ distances[docid + docBase] = d; return true; } return false;
})