Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-13803

Query planner should be able to plan $text queries that require collection scan

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.6.0
    • Component/s: Querying, Text Search
    • Labels:
    • Query Integration

      On a schema like the following:

      { _id : ObjectID, description: String}
      

      With an index like:

      { fields: { 'description': 'text' } }
      

      Doing this with $and query succeeds as expected:

      db.products.find({$and:[{$text: {$search : 'box'} }, {search:'Box'}] );
      

      But this query fails:

      db.products.find({$or:[{$text: {$search : 'Bob'} }, {search:'Bob'}] );
      

      With this error

      $err" : "Runner error: BadValue error processing query: ns=unit_test.products limit=0 skip=0
      Tree: $or
      description== \"Bob\"
      TEXT : query=Bob, language=, tag=NULL
      Sort: {}
      Proj: {}
      planner returned error: Failed to produce a solution for TEXT under OR - other non-TEXT clauses under OR have to be indexed as well.",
      "code" : 17144
      

      (I realize this seems asinine, but my actual code is quite a bit more complicated with a full-text index on several different text fields.)

            Assignee:
            backlog-query-integration [DO NOT USE] Backlog - Query Integration
            Reporter:
            wshaver Will Shaver
            Votes:
            3 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated: