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

Text search ignores some phrases

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 3.0.9, 3.2.6
    • Fix Version/s: None
    • Component/s: Text Search
    • Labels:
      None
    • Operating System:
      ALL
    • Steps To Reproduce:
      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"} })

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: