[SERVER-82284] Factorize special index predicates in the simplifier Created: 18/Oct/23  Updated: 01/Nov/23

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Alexander Ignatyev Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Issue split
split from SERVER-75079 Simplify boolean expressions before f... Closed
Assigned Teams:
Query Optimization
Participants:

 Description   

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}]}


Generated at Thu Feb 08 06:48:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.