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

Query planner should allow assignment of range predicates to compound text index prefix keys

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

      On a schema like the following:

      { _id : ObjectID, productId: String, description: String}
      

      With an index like:

      { fields: { 'productId': 1,  'description': 'text' } }
      

      Doing this query succeeds as expected:

      db.products.find({productId: 'P1234', $text: {$search : 'box'} } );
      

      But this query fails:

      db.products.find({productId: {$in: ['S00001', 'S00004'] }, $text: {$search : 'box'} } );
       "$err" : "Unable to execute query: error processing query: ns=unit_test.products limit=0 skip=0\nTree: $and\n    productId $in [ \"S00001\" \"S00004\" ]\n    TEXT : query=multiple, language=, tag=NULL\nSort: {}\nProj: {}\n planner returned error: failed to use text index to satisfy $text query (if text index is compound, are equality predicates given for all prefix fields?)",
              "code" : 17007
      

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

              Created:
              Updated: