-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Fully Compatible
-
ALL
-
0
-
None
-
None
-
None
-
None
-
None
-
None
-
None
In SERVER-26833, a $text query can be optimized to not use a blocking TEXT_OR stage when user doesn't specify any textScore projection, instead to use a OR stage. In BF-16877, Aggregation failed to respect this optimization.
The query plan for the aggregate() $text query:
db.fuzzer_coll.explain().aggregate([{"$match":{"$text":{"$search" : "Dynamic"}}}]);
"winningPlan" : {
"stage" : "TEXT",
"indexPrefix" : {
},
"indexName" : "$**_text",
"parsedTextQuery" : {
"terms" : [
"dynam"
],
"negatedTerms" : [ ],
"phrases" : [ ],
"negatedPhrases" : [ ]
},
"textIndexVersion" : 3,
"inputStage" : {
"stage" : "TEXT_MATCH",
"inputStage" : {
"stage" : "TEXT_OR",
"inputStage" : {
"stage" : "IXSCAN",
"keyPattern" : {
"_fts" : "text",
"_ftsx" : 1
},
"indexName" : "$**_text",
"isMultiKey" : true,
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2,
"direction" : "backward",
"indexBounds" : {
}
}
}
}
}
The query plan for the equivalent find() $text query:
db.fuzzer_coll.explain().find({$text:{$search: "Dynamic"}});
"winningPlan" : {
"stage" : "TEXT",
"indexPrefix" : {
},
"indexName" : "$**_text",
"parsedTextQuery" : {
"terms" : [
"dynam"
],
"negatedTerms" : [ ],
"phrases" : [ ],
"negatedPhrases" : [ ]
},
"textIndexVersion" : 3,
"inputStage" : {
"stage" : "TEXT_MATCH",
"inputStage" : {
"stage" : "FETCH",
"inputStage" : {
"stage" : "OR",
"inputStage" : {
"stage" : "IXSCAN",
"keyPattern" : {
"_fts" : "text",
"_ftsx" : 1
},
"indexName" : "$**_text",
"isMultiKey" : true,
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2,
"direction" : "backward",
"indexBounds" : {
}
}
}
}
}
}
- is related to
-
SERVER-26833 Permit non-blocking $text queries when user doesn't request score projection
-
- Closed
-