[SERVER-10356] Text searches with negated terms in phrases don't match correctly Created: 26/Jul/13  Updated: 11/Jul/16  Resolved: 09/Aug/13

Status: Closed
Project: Core Server
Component/s: Text Search
Affects Version/s: 2.5.1
Fix Version/s: 2.5.2

Type: Bug Priority: Major - P3
Reporter: Tyler Brock Assignee: J Rassi
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

db.test.drop()
db.test.insert({words: "tyler dogs"})
db.test.ensureIndex({"words": "text"})
 
// expect no results, phrase match works
> db.test.runCommand('text', {search: "\"tyler cats\""})
{
	"queryDebugString" : "cat|tyler||||tyler cats||",
	"results" : [ ]
}
 
// expect no results, phrase match ignores cats!
> db.test.runCommand('text', {search: "\"tyler -cats\""})
{
	"queryDebugString" : "tyler||||||tyler -cats",
	"results" : [
		{
			"score" : 0.75,
			"obj" : {
				"_id" : ObjectId("51f2c3adf9477b8250ef438a"),
				"words" : "tyler dogs"
			}
		}
	]
}

Would highly recommend backport to 2.4.x. when this gets resolved.



 Comments   
Comment by J Rassi [ 09/Aug/13 ]

Resolving. dan@10gen.com, note Tyler's request for backport.

Comment by auto [ 09/Aug/13 ]

Author:

{u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

Message: SERVER-10356 FTSQuery negated terms in phrase shouldn't negate phrase

This fixes a bug where creating an FTSQuery with a phrase that contains
a negated term (e.g. "tyler -dogs") would cause the phrase itself to be
incorrectly added to _negatedPhrases.
Branch: master
https://github.com/mongodb/mongo/commit/40574e41cfcd89df3e173af4df8feed09fed3579

Comment by Tyler Brock [ 09/Aug/13 ]

Any way we could backport to 2.4.x as well?

Generated at Thu Feb 08 03:22:57 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.