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

Error message incorrect for $text query on compound text index w/o index prefix match

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 2.6.0-rc2
    • 2.6.0-rc0
    • Text Search
    • ALL

    Description

      When a $text query fails because of a missing predicate on the text index prefix, the error message should be "missing equality predicate on text index prefix field", not "need exactly one text index".

      > db.foo.ensureIndex({a:1,b:"text"})
      WriteResult({ "nInserted" : 1 })
      > db.foo.insert({a:1,b:"hello"})
      WriteResult({ "nInserted" : 1 })
      > db.foo.find({a:1,$text:{$search:"hello"}})
      { "_id" : ObjectId("53151373b685b3ee5e58e538"), "a" : 1, "b" : "hello" }
      > db.foo.find({$text:{$search:"hello"}})
      error: {
      	"$err" : "Unable to execute query: error processing query: ns=test.foo limit=0 skip=0\nTree: TEXT : query=hello, language = , tag=First: notFirst: full path: _fts\nSort: {}\nProj: {}\n planner returned error: need exactly one text index for $text query",
      	"code" : 17007
      }
      >

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: