Uploaded image for project: 'Lucene.Net'
  1. Lucene.Net
  2. LUCENENET-448

GeoHashFilteredDocIdSet does not work at all

    XMLWordPrintableJSON

    Details

      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;
      })

      { _geoHashValues = geoHashValues; _distances = distances; _distance = distance; _docBase = docBase; _lng = lng; _lat = lat; _distanceLookupCache = distanceLookupCache; }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jjxtra Jeff Johnson
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified