-
Type: Improvement
-
Resolution: Won't Fix
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Querying, Text Search
-
Labels:None
-
Query
-
Fully Compatible
To set the terminology:
In the following index description
{a: 1, b: 1, c: "text", d: 1, e: 1}
the text index prefix is {a: 1, b: 1} and the text index suffix is {d: 1, e: 1}.
Predicates over the fields in the text index suffix are not used to constrain the number of documents index-scanned during a full-text search.
For example consider a collection where the search predicate
{a: 123, b: 456, $text: {$search: 'foo bar'}}
would find 30 documents, and
{a: 123, b: 456, $text: {$search: 'foo bar'}, d: {$gte: 0}}
would find only 10 documents.
During the second query the query optimizer does not use the 'd' predicate to avoid scanning the other 20 documents during the query execution. The "nscanned" value will be 30 for both, even though "n" is different.