[DOCS-3863] Comment on: "manual/reference/operator/query/text.txt" Created: 04/Aug/14  Updated: 03/Nov/17  Resolved: 04/Aug/14

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: 01112017-cleanup

Type: Improvement Priority: Major - P3
Reporter: Claudio Marrero Assignee: Unassigned
Resolution: Done Votes: 0
Labels: collector-298ba4e7
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

windows 7 profesional, Linux 14.10, mongodb 2.6.3

Location: http://docs.mongodb.org/manual/reference/operator/query/text/
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36
Referrer: http://docs.mongodb.org/manual/reference/operator/query/regex/
Screen Resolution: 1600 x 900
repo: docs
source: reference/operator/query/text


Participants:
Days since reply: 9 years, 28 weeks, 2 days ago

 Description   

I found a Bug on search query in mongodb:

if you add a repeat character in the end of the stringg, the query not find the document.

For example:

db.foo.insert(

{desc: "This is a string with text"}

);
db.foo.insert(

{desc:"This is a string with textt"}

);
db.foo.ensureIndex(

{"desc":"text"}

);
db.foo.find({
$text:

{ $search:"text" }

});

The Result is:

{
"_id" : ObjectId("53dfd9453e1e4201402d2f5d"),
"desc" : "This is a string with text"
}

And that query, should be:

{
"_id" : ObjectId("53dfd9453e1e4201402d2f5d"),
"desc" : "This is a string with text"
}
{
"_id" : ObjectId("53dfd9453e1e4201402d2f5e"),
"desc" : "This is a string with textt"
}



 Comments   
Comment by Kay Kim (Inactive) [ 04/Aug/14 ]

Hi Claudio –
thanks for taking the time to file this ticket with very clear examples.

The text search matches on the *complete stemmed* words. For example, if a document field contains the word blueberry, a search on the term blue will not match the document.

So, for your example, I believe the complete stemmed word for textt is textt and the stemmed search term for text is text and since the match is on the complete stemmed word, the two will not match.

For more information, refer to http://docs.mongodb.org/manual/core/index-text/#text-search

Generated at Thu Feb 08 07:46:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.