Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-10356

Text searches with negated terms in phrases don't match correctly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.5.1
    • Fix Version/s: 2.5.2
    • Component/s: Text Search
    • Labels:
      None
    • Operating System:
      ALL

      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.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: