$or queries with text indexes fail on clustered collections

XMLWordPrintableJSON

    • Query Integration
    • Fully Compatible
    • ALL
    • QI 2023-04-03, QI 2023-04-17, QI 2023-05-15, QI 2023-05-29, QI 2023-06-12, QI 2023-06-26
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      It appears that using $or to query both _id and a text index do not work together.

      See this example:

      db.createCollection('c', {clusteredIndex: {key: {_id: 1}, unique: true}})
      db.c.createIndex({b: "text"})
      db.c.insert({b: "foo"}
      db.c.find({$or: [{$text: {$search: "foo"}}, {_id: 1}]})
      

      This fails with the following error:

      error processing query: ns=test.cTree: $or
          _id $eq 1
          TEXT : query=foo, language=english, caseSensitive=0, diacriticSensitive=0, tag=NULL
      Sort: {}
      Proj: {}
       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.
      

            Assignee:
            Gil Alon
            Reporter:
            Louis Williams
            Votes:
            0 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved: