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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.5.0
    • Fix Version/s: 2.4.5, 2.5.1
    • Component/s: Text Search
    • Labels:
      None
    • Operating System:
      ALL

      Description

      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.

        Attachments

          Activity

            People

            Assignee:
            rassi J Rassi
            Reporter:
            tyler@10gen.com Tyler Brock
            Participants:
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: