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

Text search ignores some phrases

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.0.9, 3.2.6
    • Component/s: Text Search
    • None
    • ALL
    • Hide
      a simple example
      db.createCollection("test")
      db.test.insert({ "Words": "some random publications"})
      db.test.insert({ "Words": "cat publications" })
      db.test.insert({ "Words": "i like cats" })
      db.test.insert({ "Words": "car publications" })
      
      db.test.createIndex({ "Words": "text" })
      
      // the word "cat" in this search seems to be ignored
      db.test.find( { $text: { $search: "\"cat\" \"publications\"" } } )
      
      // this seems to return the same results as above
      db.test.find( { $text: { $search: "\"publications\"" } } )
      
      // just in case you want to see the text score
      db.test.find({ $text: { $search: "\"cat\" \"publications\"" } }, { score: { $meta: "textScore"} })
      
      Show
      a simple example db.createCollection( "test" ) db.test.insert({ "Words" : "some random publications" }) db.test.insert({ "Words" : "cat publications" }) db.test.insert({ "Words" : "i like cats" }) db.test.insert({ "Words" : "car publications" }) db.test.createIndex({ "Words" : "text" }) // the word "cat" in this search seems to be ignored db.test.find( { $text: { $search: "\" cat\ " \" publications\"" } } ) // this seems to return the same results as above db.test.find( { $text: { $search: "\" publications\"" } } ) // just in case you want to see the text score db.test.find({ $text: { $search: "\" cat\ " \" publications\ "" } }, { score: { $meta: " textScore"} })

      When using text search, it seems that some phrases can be ignored. I am using phrase searches to perform a logical AND on several words, for example:

      $text: { $search: "\"cat\" \"publications\"" }

      ...to find results containing BOTH the words "cat" AND "publications". However, we found that with this example the phrase "cat" seems to be ignored and the search seems to just return results matching "publications".

      See the repro steps for a simple example to demonstrate the issue.

            Assignee:
            kelsey.schubert@mongodb.com Kelsey Schubert
            Reporter:
            david.hobbs@prgloo.com David Hobbs
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: