[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: |
|
||||||||||||||||||||||||
| Assigned Teams: |
Query Integration
|
||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||
| Case: | (copied to CRM) | ||||||||||||||||||||||||
| 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, | ||||||
| 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, | ||||||
| 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:
For MongoDB-related support discussion please post on the mongodb-users group or Stack Overflow with the mongodb tag. Regards, |