You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by "Digy (Resolved) (JIRA)" <ji...@apache.org> on 2011/11/01 19:05:32 UTC

[Lucene.Net] [jira] [Resolved] (LUCENENET-448) GeoHashFilteredDocIdSet does not work at all

     [ https://issues.apache.org/jira/browse/LUCENENET-448?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Digy resolved LUCENENET-448.
----------------------------

    Resolution: Fixed

Hi Jeff,
Your fix is for 2.9.4g branch and I committed it.
(Although I was hard to compare your code with the current code).
Thank you.
                
> GeoHashFilteredDocIdSet does not work at all
> --------------------------------------------
>
>                 Key: LUCENENET-448
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-448
>             Project: Lucene.Net
>          Issue Type: Bug
>          Components: Lucene.Net Contrib
>    Affects Versions: Lucene.Net 2.9.4g
>         Environment: Windows 7 x64
>            Reporter: Jeff Johnson
>              Labels: contrib, spatial
>             Fix For: Lucene.Net 2.9.4g
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> 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;
> 			}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira