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

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 2.5.0
    • 2.4.5, 2.5.1
    • Text Search
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: