[SERVER-22583] Allow text search to OR exact phrases Created: 11/Feb/16  Updated: 27/Dec/23

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

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

Issue Links:
Duplicate
is duplicated by SERVER-27946 Logical AND operator in Text Search -... Closed
is duplicated by SERVER-28522 Is there a way to force at least one ... Closed
Related
is related to SERVER-30163 Additional terms in phrase search are... Backlog
is related to SERVER-23619 Allow the delimiter set recognized by... Backlog
Assigned Teams:
Query Integration
Participants:
Case:

 Description   

When searching text index for "abc-xyz", it is retrieving documents correctly with abc-xyz, but it is also pulling searches for abc or xyz as well. I've tested with diacriticSensitive set to true, but that still returned same results.

I stumbled on this issue when trying to run an OR search on multiple words with the hyphenation, which returns the same incorrect results e.g. "abc-xyz efg hij", which returns: "abc-xyz efg hij abc xyz" when it should be returning "abc-xyz efg hij".



 Comments   
Comment by Ramon Fernandez Marina [ 15/Jun/16 ]

mknwebsolutions, this ticket is in "Backlog", so it's not scheduled in the current development cycle. It will be considered in the next round of planning, and watchers of the ticket will receive notifications when the planning changes.

Regards,
Ramón.

Comment by Michael Mikhjian [ 15/Jun/16 ]

Any updates on this?

Comment by Michael Mikhjian [ 12/Feb/16 ]

No problem, thanks Thomas!

Comment by Kelsey Schubert [ 12/Feb/16 ]

Hi mknwebsolutions,

Sorry for the confusion. Yes, you are correct, currently it is not possible to OR an exact phrase. I'll mark this ticket as an improvement request to allow text search to OR exact phrases and send it to the query team to be scheduled during the next planning session. Please continue to watch this ticket for updates.

Thank you,
Thomas

Comment by Michael Mikhjian [ 12/Feb/16 ]

So the issue with the "exact phrase" is that it doesn't allow for searching ORs, i.e. like my latter example in my description.

Searching: db.foo.find({$text:{$search:"\"abc-xyz\" efg"}}) will yield results only with abc-xyz AND efg (because abc-xyz is an exact match requirement). This does not allow for multiple searches with exact hyphens.

So it's basically impossible to do an OR search e.g. "abc-xyz" OR "abc-efg", because again utilizing the escape quotes defines it as exact search / requirement, right?

Comment by Kelsey Schubert [ 12/Feb/16 ]

Hi Michael,

Thanks for the report: this is expected behavior and is documented here. The hypen in "abc-xyz" is treated as a delimiter. If you would like to match the exact phrase as a single term, escape the quotes.

Please review the following example:

> db.foo.find({$text:{$search:"abc-xyz"}})
{ "_id" : ObjectId("56bcddd28793ab3378170530"), "x" : "xyz" }
{ "_id" : ObjectId("56bcddc38793ab337817052e"), "x" : "abc-xyz" }
{ "_id" : ObjectId("56bcddc78793ab337817052f"), "x" : "abc" }
> db.foo.find({$text:{$search:"\"abc-xyz\""}})
{ "_id" : ObjectId("56bcddc38793ab337817052e"), "x" : "abc-xyz" }

For MongoDB-related support discussion please post on the mongodb-users group or Stack Overflow with the mongodb tag.

Regards,
Thomas

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