[SERVER-13801] Query planner should allow assignment of range predicates to compound text index prefix keys Created: 30/Apr/14  Updated: 28/Dec/23

Status: Backlog
Project: Core Server
Component/s: Querying, Text Search
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Will Shaver Assignee: Backlog - Query Integration
Resolution: Unresolved Votes: 8
Labels: qi-text-search
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Assigned Teams:
Query Integration
Participants:

 Description   

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



 Comments   
Comment by Adam Wamai Egesa [ 04/Apr/18 ]

As a user of the database API the limitation seems arbitrary while it really feels like the performance implications are really large for some implementations or forces us to change or database model quite a lot so definitely think the "Major - P3" priority label is well earned.

That said, can we expect this to be prioritized for implementation soon? Or be given any estimation for what release this improvement will likely target? At this point I would assume it won't make it into the next coming major release, version 4.0. But maybe 4.2?

Comment by Peter Sunde [ 09/Sep/15 ]

Will this feature be available in mongo 3.2 ?

Comment by rohit lala [ 23/Apr/15 ]

Hi, any update on this JIRA ticket?

Comment by Zack Carlson [ 31/Jul/14 ]

Is there a % likelyhood that the bounds generation predicates would be included in 2.7 (October?)

Comment by J Rassi [ 01/May/14 ]

This is not currently supported; to use your index, queries must include an equality predicate on productId. Note the query error message "are equality predicates given for all prefix fields?" (see this page in the documentation for further info).

Further work in this area will allow relaxing the equality predicate requirement, at which point any bounds-generating predicate would be able to substitute for it (e.g. $gt/$gte/$lt/$lte/$in/$type composed with $and/$or etc).

Changing ticket type from "Bug" to "Improvement".

Comment by Will Shaver [ 30/Apr/14 ]

This also fails with the same error:

{$or: [{productId: 'S00001'}, {productId: 'S00004'}], $text: {$search : 'box'} }

Comment by Will Shaver [ 30/Apr/14 ]

And... I'd fix the formatting in my post but I can't edit now.

Generated at Thu Feb 08 03:32:56 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.