[SERVER-76176] $text OR condition on phrases not working Created: 17/Apr/23 Updated: 27/Oct/23 Resolved: 07/Jun/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Abdul Mateen Ahmad Khan | Assignee: | Arun Banala |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Assigned Teams: |
Query Integration
|
||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||
| Sprint: | QI 2023-05-29, QI 2023-06-12 | ||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Description |
|
Hello , I think i have found a bug with $text command which is used to invoke the text indexes. The command fails when we are trying to search for multiple phrases and use an OR condition. for example: This command tokenizes the first phrase and gets documents having 'works' keyword OR 'company1' keyword OR 'Adam' keyword. which is not what we want. We want the command to get 'works at walee' phrase which is not what the command does. the AND command: works fine and only gets documents which has both the phrase and the keyword doing exact phrase matching . |
| Comments |
| Comment by Arun Banala [ 07/Jun/23 ] | |
|
abdmateen@gmail.com Unfortunately conjunction of multiple phrases is not supported with text indexes. Please refer to the documentation here section in the docs.
The phrases cannot be used in conjunction with individual terms either.
So I don't think there is any way to use just the text indexes to achieve what you are trying to do. However, I think you can make use of text indexes to match a superset of results that you want to match, then use the regex filter to further filter down the phrases. So something like the below should help
| |
| Comment by Abdul Mateen Ahmad Khan [ 18/Apr/23 ] | |
|
just to add context , this is the issue i am talking about if you want another example.
I don't think this functionality has been added by mongodb creator team as of yet. |