[SERVER-9214] Phrase search won't match phrases that aren't space-delimited Created: 02/Apr/13  Updated: 11/Jul/16  Resolved: 03/Apr/13

Status: Closed
Project: Core Server
Component/s: Text Search
Affects Version/s: 2.4.1
Fix Version/s: 2.4.3, 2.5.0

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

Issue Links:
Duplicate
is duplicated by SERVER-9413 Text search seems to support solely a... Closed
Operating System: ALL
Participants:

 Description   

The query parser generates the phrase list from the token stream, separating tokens with spaces. The phrase matcher performs a byte-by-byte comparison to determine a match (post-lowercasing). Thus, the only documents that will be returned in a phrase match are documents in which the phrase tokens are space-delimited.

See, for example:

> db.foo.ensureIndex({a:"text"},{default_language:"none"})
> db.foo.find()
{ "_id" : ObjectId("515b316ed8714740e78cf351"), "a" : "foo-bar" }
{ "_id" : ObjectId("515b3170d8714740e78cf352"), "a" : "foo.bar" }
{ "_id" : ObjectId("515b3172d8714740e78cf353"), "a" : "foo+bar" }
{ "_id" : ObjectId("515b3174d8714740e78cf354"), "a" : "foo/bar" }
{ "_id" : ObjectId("515b31e3d8714740e78cf355"), "a" : "foo, bar" }
{ "_id" : ObjectId("515b31e5d8714740e78cf356"), "a" : "foo  bar" }
> db.foo.runCommand("text",{search:'"foo-bar"'}).results.length
0
> db.foo.runCommand("text",{search:'"foo.bar"'}).results.length
0
> db.foo.runCommand("text",{search:'"foo+bar"'}).results.length
0
> db.foo.runCommand("text",{search:'"foo/bar"'}).results.length
0
> db.foo.runCommand("text",{search:'"foo, bar"'}).results.length
0
> db.foo.runCommand("text",{search:'"foo  bar"'}).results.length
0
> db.foo.runCommand("text",{search:'"foo bar"'}).results.length
0

All of the above searches yield queryDebugString "bar|foo||||foo bar||"



 Comments   
Comment by auto [ 18/Apr/13 ]

Author:

{u'date': u'2013-04-03T04:32:15Z', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

Message: SERVER-9214 Change tolowerString argument type to StringData
Branch: v2.4
https://github.com/mongodb/mongo/commit/036337a5c0757e7a06ea3fc3f98efd467b27b43e

Comment by auto [ 18/Apr/13 ]

Author:

{u'date': u'2013-04-03T12:48:39Z', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'}

Message: SERVER-9214 initialize variable to placate compiler
Branch: v2.4
https://github.com/mongodb/mongo/commit/be1e22fea51d58429fd6db167d1fe49090f75424

Comment by auto [ 18/Apr/13 ]

Author:

{u'date': u'2013-04-03T04:33:24Z', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

Message: SERVER-9214 Extract phrases from text searches as exact substrings
Branch: v2.4
https://github.com/mongodb/mongo/commit/37f20624204b2eaeec6d15aab6bb32e6879fa029

Comment by Ian Whalen (Inactive) [ 17/Apr/13 ]

this has not yet been backported - it is still under consideration for backporting to 2.4.3

Comment by Tyler Brock [ 17/Apr/13 ]

Did this get backported to 2.4.2?

Comment by auto [ 03/Apr/13 ]

Author:

{u'date': u'2013-04-03T12:48:39Z', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'}

Message: SERVER-9214 initialize variable to placate compiler
Branch: master
https://github.com/mongodb/mongo/commit/b98575fa80b8fac5ad3bb52172dff9ce6070aa1c

Comment by auto [ 03/Apr/13 ]

Author:

{u'date': u'2013-04-03T04:33:24Z', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

Message: SERVER-9214 Extract phrases from text searches as exact substrings
Branch: master
https://github.com/mongodb/mongo/commit/145f0b74af82e2b9b2d3c78052fd3a7df9f7c0b3

Comment by auto [ 03/Apr/13 ]

Author:

{u'date': u'2013-04-03T04:32:15Z', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

Message: SERVER-9214 Change tolowerString argument type to StringData
Branch: master
https://github.com/mongodb/mongo/commit/658cf5e72f1a901a37bef2af8ce0943a2d242c86

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