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

Collation causes issue with a certain find condition

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: 4.0.1
    • Fix Version/s: None
    • Component/s: Text Search
    • Labels:
      None
    • Operating System:
      ALL
    • Steps To Reproduce:
      1. Create a Collection "Plan"
      2. Create index for full text search
      3. Add a few records
      4. Run the query

      Description

      I have a query - 

      db.getCollection('Plan').find(
          {$or:[
              {"_id":{$in:["PLN000000020","PLN000000014"]}},
              {$text:{$search:"test"}}]
          })
          .sort( { "name": 1 })
          .skip(0)
          .limit(10)
          .collation({locale:'en'})
      

      There is an index on '_id' and a Full text search index ("$**":"text")

      This query fails saying -

      error processing query: ns=Apeiron.Plan limit=10Tree: $or\n    _id $in [ \"PLN000000014\" \"PLN000000020\" ]\n    TEXT : query=test, language=english, caseSensitive=0, diacriticSensitive=0, tag=NULL\nSort: { name: 1.0 }\nProj: {}\nCollation: { locale: \"en\" }\n planner returned error: Failed to produce a solution for TEXT under OR - other non-TEXT clauses under OR have to be indexed as well.
      

      Is there a workaround for it ? How do I specify collation of a collection along with full text search index?

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: