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

Text search matcher can incorrectly match documents if multi-language or contain text-indexed nested arrays

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical - P2 Critical - P2
    • None
    • 2.5.4
    • Text Search
    • None
    • ALL

    Description

      textIndexVersion:2 indexes observe subdocument language annotations (and correctly index nested arrays, if not directly nested). The text search matcher needs to invoke the correct language stemmer on text contained in subdocuments (and examine fields in nested arrays for determining a match), but doesn't.

      Reproduce with:

      > db.foo.ensureIndex({"a.b":"text"})
      > db.foo.insert({a:[{b:["example content"]}]}) // note indexed nested arrays
      Insert WriteResult({ "ok" : 1, "n" : 1 })
      > db.foo.find({$text:{$search:"example content"}}) // correct
      { "_id" : ObjectId("52aa57a0ae39c4212eb00625"), "a" : [ { "b" : [ "example content" ] } ] }
      > db.foo.find({$text:{$search:"example -content"}}) // incorrect: should return empty result set
      { "_id" : ObjectId("52aa57a0ae39c4212eb00625"), "a" : [ { "b" : [ "example content" ] } ] }
      > db.foo.find({$text:{$search:"example \"content\""}}) // incorrect: should not return empty result set
      >

      Attachments

        Activity

          People

            rassi J Rassi
            rassi J Rassi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: