diff options
author | Hari Khalsa <hkhalsa@10gen.com> | 2013-04-29 15:22:03 -0400 |
---|---|---|
committer | Hari Khalsa <hkhalsa@10gen.com> | 2013-05-02 15:39:37 -0400 |
commit | fc76b559266c4e2aee0707e6d640c08d20ff9e55 (patch) | |
tree | e09040278d86baf58aa6861e4574f4fe3dcac713 /src/mongo/db/index | |
parent | 623683b0f717769626381f4d3fb6f62170ffd137 (diff) | |
download | mongo-fc76b559266c4e2aee0707e6d640c08d20ff9e55.tar.gz |
SERVER-9484 don't ignore geometries w/>1 covers if one of them isn't in the search annulus
Diffstat (limited to 'src/mongo/db/index')
-rw-r--r-- | src/mongo/db/index/s2_near_cursor.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/mongo/db/index/s2_near_cursor.cpp b/src/mongo/db/index/s2_near_cursor.cpp index 3e5a7b34cce..7983ee4a915 100644 --- a/src/mongo/db/index/s2_near_cursor.cpp +++ b/src/mongo/db/index/s2_near_cursor.cpp @@ -235,8 +235,6 @@ namespace mongo { continue; } - seen.insert(cursor->currLoc()); - // Get distance interval from our query point to the cell. // If it doesn't overlap with our current shell, toss. BSONObj currKey(cursor->currKey()); @@ -252,13 +250,20 @@ namespace mongo { continue; } + // We have to add this document to seen *AFTER* the key intersection test. + // A geometry may have several keys, one of which may be in our search shell and one + // of which may be outside of it. We don't want to ignore a document just because + // one of its covers isn't inside this annulus. + seen.insert(cursor->currLoc()); + + // At this point forward, we will not examine the document again in this annulus. + const BSONObj& indexedObj = cursor->currLoc().obj(); // Match against indexed geo fields. ++_stats._geoMatchTested; size_t geoFieldsMatched = 0; - // OK, cool, non-geo match satisfied. See if the object actually overlaps w/the geo - // query fields. + // See if the object actually overlaps w/the geo query fields. for (size_t i = 0; i < _indexedGeoFields.size(); ++i) { BSONElementSet geoFieldElements; indexedObj.getFieldsDotted(_indexedGeoFields[i].getField(), geoFieldElements, |