Factorize special index predicates in the simplifier

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

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

              Assignee:
              [DO NOT USE] Backlog - Query Optimization
              Reporter:
              Alexander Ignatyev
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: