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

$or query with text index failed

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • ALL
    • Hide

      1.create text index for "a"

      2.create nomral index for "b"

      3.execute

      db.getCollection('xxx').find({  
          "$or" : 
              [
                  { "$text" : { "$search" : "xx"}},
                  {"b" :  "xx"}
              ]
          }
         ).collation({"locale":"en", "numericOrdering":true})

       

      4.get error

       "planner returned error :: caused by :: Failed to produce a solution for TEXT under OR - other non-TEXT clauses under OR have to be indexed as well.",

      Show
      1.create text index for "a" 2.create nomral index for "b" 3.execute db.getCollection('xxx').find({       "$or" :          [             { "$text" : { "$search" : "xx"}},             {"b" :  "xx"}         ]     }    ).collation({"locale":"en", "numericOrdering":true})   4.get error  "planner returned error :: caused by :: Failed to produce a solution for TEXT under OR - other non-TEXT clauses under OR have to be indexed as well.",

      An error occurred when using &or and adding collation({"locale":"en", "numericOrdering":true}) for query with text index

            Assignee:
            yuan.fang@mongodb.com Yuan Fang
            Reporter:
            449287455@qq.com ming 2hi
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: