diff options
Diffstat (limited to 'src/mongo/db/exec/near.cpp')
-rw-r--r-- | src/mongo/db/exec/near.cpp | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/mongo/db/exec/near.cpp b/src/mongo/db/exec/near.cpp index 1568339cbfe..760bf4f1247 100644 --- a/src/mongo/db/exec/near.cpp +++ b/src/mongo/db/exec/near.cpp @@ -202,7 +202,7 @@ PlanStage::StageState NearStage::bufferNext(WorkingSetID* toReturn, Status* erro } } - ++_nextIntervalStats->numResultsFound; + ++_nextIntervalStats->numResultsBuffered; StatusWith<double> distanceStatus = computeDistance(nextMember); @@ -216,12 +216,6 @@ PlanStage::StageState NearStage::bufferNext(WorkingSetID* toReturn, Status* erro // results. double memberDistance = distanceStatus.getValue(); - // Update found distance stats - if (_nextIntervalStats->minDistanceFound < 0 || - memberDistance < _nextIntervalStats->minDistanceFound) { - _nextIntervalStats->minDistanceFound = memberDistance; - } - _resultBuffer.push(SearchResult(nextMemberID, memberDistance)); // Store the member's RecordId, if available, for quick invalidation @@ -275,7 +269,7 @@ PlanStage::StageState NearStage::advanceNext(WorkingSetID* toReturn) { return PlanStage::NEED_TIME; } - // The next document in _resultBuffer is in the search interval, so we can return it + // The next document in _resultBuffer is in the search interval, so we can return it. _resultBuffer.pop(); // If we're returning something, take it out of our RecordId -> WSID map so that future @@ -286,14 +280,8 @@ PlanStage::StageState NearStage::advanceNext(WorkingSetID* toReturn) { _seenDocuments.erase(member->loc); } - // TODO: SERVER-19480 Find a more appropriate place to increment numResultsBuffered - ++_nextIntervalStats->numResultsBuffered; - - // Update buffered distance stats - if (_nextIntervalStats->minDistanceBuffered < 0 || - memberDistance < _nextIntervalStats->minDistanceBuffered) { - _nextIntervalStats->minDistanceBuffered = memberDistance; - } + // This value is used by nextInterval() to determine the size of the next interval. + ++_nextIntervalStats->numResultsReturned; return PlanStage::ADVANCED; } |