summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/text.cpp
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2014-12-17 09:45:08 -0500
committerMark Benvenuto <mark.benvenuto@mongodb.com>2014-12-22 15:52:40 -0500
commit0855e8c092879ba3a1e1b5bd812f72ecb21c6442 (patch)
tree6d9076ac63e154855029d5619311cc2f4e93c2e6 /src/mongo/db/exec/text.cpp
parentbfdf9bce1f3091e8a6245d46a395ecdfc0bc0a1d (diff)
downloadmongo-0855e8c092879ba3a1e1b5bd812f72ecb21c6442.tar.gz
SERVER-16390: Text stage fetches document twice if phrase or negation filter present
Diffstat (limited to 'src/mongo/db/exec/text.cpp')
-rw-r--r--src/mongo/db/exec/text.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mongo/db/exec/text.cpp b/src/mongo/db/exec/text.cpp
index 2f0c5a6c967..037b20c28aa 100644
--- a/src/mongo/db/exec/text.cpp
+++ b/src/mongo/db/exec/text.cpp
@@ -279,9 +279,12 @@ namespace mongo {
return PlanStage::NEED_TIME;
}
+ // Fetch the document
+ BSONObj doc(_params.index->getCollection()->docFor(_txn, loc));
+
// Filter for phrases and negated terms
if (_params.query.hasNonTermPieces()) {
- if (!_ftsMatcher.matchesNonTerm(_params.index->getCollection()->docFor(_txn, loc))) {
+ if (!_ftsMatcher.matchesNonTerm(doc)) {
return PlanStage::NEED_TIME;
}
}
@@ -289,7 +292,7 @@ namespace mongo {
*out = _ws->allocate();
WorkingSetMember* member = _ws->get(*out);
member->loc = loc;
- member->obj = _params.index->getCollection()->docFor(_txn, member->loc);
+ member->obj = doc;
member->state = WorkingSetMember::LOC_AND_UNOWNED_OBJ;
member->addComputed(new TextScoreComputedData(score));
return PlanStage::ADVANCED;