[SERVER-18633] Text search cannot do both stemming and logical AND Created: 22/May/15  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: Sean Reilly Assignee: Backlog - Query Integration
Resolution: Unresolved Votes: 1
Labels: qi-text-search
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Integration
Participants:

 Description   

By default providing a list of words separated by spaces performs a search to find any of the specified words (logical OR), with stemming of each word. Logical AND isn't supported.

The common workaround to perform a logical AND seems to be to wrap each word in quotes to do phrase matching. However, this has the side effect of disabling stemming.

Steps to reproduce:

1. Insert some data

use textSearch
db.foo.createIndex({"$**": "text"})
db.foo.save({phrase: "phrase includes foo"})
db.foo.save({phrase: "phrase includes bar"})

2. Returning both inserted documents using the query terms "including" and "foo" with stemming and a logical OR is possible:

db.foo.find({$text: {$search: "including foo"}}).count()

3. Using an exact phrase matching to create a logical and without stemming to find one document is possible:

db.foo.find({$text: {$search: "\"includes\" \"foo\""}}).count()

4. Combining the logical and with word stemming to return only the first inserted document using the query terms "including" and "foo" doesn't seem to be possible.



 Comments   
Comment by Sean Reilly [ 22/May/15 ]

Fair enough on the 3.0 backport. It sounds like a 3.1 release isn't likely either.

Comment by J Rassi [ 22/May/15 ]

Thanks for filing this improvement request. This is certainly a use case we'd like to support, although we're not considering additional major improvements to the text search subsystem for the upcoming release. Triaging in "Planning Bucket A". See also closely-related ticket SERVER-17535.

Note that I'm also denying the v3.0 backport request on this ticket, as we typically only consider critical bugfixes for backport.

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