[SERVER-36519] Index search Created: 08/Aug/18 Updated: 04/Sep/18 Resolved: 08/Aug/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | 3.6.6, 4.1.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Sameesh | Assignee: | Nick Brewer |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Operating System: | ALL |
| Steps To Reproduce: | {{db.articles.insert([ { _id: 1, subject: "one", author: "abc", views: 50 }, { _id: 2, subject: "lastone", author: "abc", views: 5 }, { _id: 3, subject: "firstone", author: "abc", views: 90 }, { _id: 4, subject: "everyone", author: "abc", views: 100 }, { _id: 5, subject: "allone", author: "efg", views: 100 }, { _id: 6, subject: "noone", author: "efg", views: 100 }, { _id: 7, subject: "nothing", author: "abc", views: 100 }])}} {{}}{{db.articles.createIndex( {subject: "text", author: "text"})}}{{}} }}{{db.articles.count({$text: {$search: "\"one\"")}}{{}} }}{{db.articles.count({$text: {$search: "\"one\" \"abc\""}}{{}} {{}} |
| Participants: |
| Description |
|
I had created a collection in mongo db as show below {{db.articles.insert([ { _id: 1, subject: "one", author: "abc", views: 50 }, { _id: 2, subject: "lastone", author: "abc", views: 5 }, { _id: 3, subject: "firstone", author: "abc", views: 90 }, { _id: 4, subject: "everyone", author: "abc", views: 100 }, { _id: 5, subject: "allone", author: "efg", views: 100 }, { _id: 6, subject: "noone", author: "efg", views: 100 }, { _id: 7, subject: "nothing", author: "abc", views: 100 }])}} after that I given text indexing to the field subject and author. {{db.articles.createIndex( {subject: "text", author: "text"})}} Now I am trying to search a word with "one" in indexed field. When I execute query ... db.articles.count({$text: {$search: "\"one\"")}} ... the result is 1. The problem is that when I want combination of words "one", "abc" ... db.articles.count({$text: {$search: "\"one\" \"abc\""}} ... it gives the result as 4. Including the records that contains the subject name as "lastone", "firstone", "everyone", "one" as the result. So my question is that why the first query dosn't fetch 4 records |
| Comments |
| Comment by Nick Brewer [ 08/Aug/18 ] |
|
Thanks for your report. Please note that SERVER project is for reporting bugs or feature suggestions for the MongoDB server. For MongoDB-related support discussion please post on the mongodb-user group or Stack Overflow with the mongodb tag. A question like this involving more discussion would be best posted on the mongodb-user group. -Nick |