Non-text fields in compound text index spec are re-ordered by reIndex or initial sync

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 2.4.5, 2.5.1
    • Affects Version/s: 2.5.0
    • Component/s: Text Search
    • None
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      Create the index:

      db.collection.ensureIndex({ words: "text", additional: 1 })
      db.collection.getIndexes()
      [
        {
          "v": 1,
          "key": {
            "_id": 1
          },
          "ns": "test.collection",
          "name": "_id_"
        },
        {
          "v": 1,
          "key": {
            "_fts": "text",
            "_ftsx": 1,
            "additional": 1
          },
          "ns": "test.collection",
          "name": "words_text_additional_1",
          "weights": {
            "words": 1
          },
          "default_language": "english",
          "language_override": "language",
          "textIndexVersion": 1
        }
      ]
      

      reIndex() reorders fields:

      db.collection.reIndex()
      [
        {
          "v": 1,
          "key": {
            "_id": 1
          },
          "ns": "test.collection",
          "name": "_id_"
        },
        {
          "v": 1,
          "key": {
            "additional": 1,
            "_fts": "text",
            "_ftsx": 1
          },
          "ns": "test.collection",
          "name": "words_text_additional_1",
          "weights": {
            "words": 1
          },
          "default_language": "english",
          "language_override": "language",
          "textIndexVersion": 1
        }
      ]
      

      At this point the index cannot be used as the additional field must appended and not a prefix.

            Assignee:
            J Rassi (Inactive)
            Reporter:
            Tyler Brock (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: