|
The special index predicates (geo, text) can be used just once in one filter expression, if it happens that the simplified expression contains more than one of such predicates, the simplified expression is cancelled and the original one is used. We can fix it by factoring the factorizing optimized expressions. E.g. the expression like
|
{$or: [{a: 1}, {$text: {$search: 'a'}}, {b: 1}, {$text: {$search: 'a'}}, {c: 1}]}
|
|
can be factorized to
|
{$or: [{$and: [{$text: {$search: 'a'}}, {$or: [{a: 1}, {b: 1}]}]}, {c: 1}]}
|
|
|