///<inheritdoc/> public (IEnumerable <IndexEntry <T> >, string) Query(string hash, int minimumHits = 1, bool lockPrecision = false, T exclude = default) { IEnumerable <IndexEntry <T> > entries; while (true) { var trieMapSearchResult = _trieMap.Search(hash); entries = trieMapSearchResult.SelectMany(sr => sr.IndexEntries); // Each entry in the map is a list, so we flatten the result int hitCount; if (exclude != null && !exclude.Equals(default(T))) { entries = entries.Where(entry => !entry.Value.Equals(exclude)); } hitCount = entries.Count(); if (hitCount >= minimumHits) { break; } else if (lockPrecision) { break; } else if (hash.Length == 1) { break; } hash = _geohasher.Reduce(hash); } return(entries, hash); }
private IEnumerable <IndexEntry <T> > Search(string geohash) { IEnumerable <IndexEntry <T> > entries; var trieMapSearchResult = _trieMap.Search(geohash); entries = trieMapSearchResult.SelectMany(sr => sr.IndexEntries); // Each entry in the map is a list, so we flatten the result return(entries); }