> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# decompoundedAttributes

> Attributes for which to split compound words into parts

export const Setting = ({type, default: defaultValue, defaultNote, scope, min, max, formerly}) => {
  const renderedDefault = defaultValue === '' ? '""' : defaultValue;
  const renderedNote = defaultNote ? `(${defaultNote})` : '';
  return <ul>
      <li><strong>Type:</strong> <code>{type}</code></li>
      <li><strong>Default:</strong> <code>{renderedDefault}</code>{renderedNote}</li>
      {min && <li><strong>Min:</strong> <code>{min}</code></li>}
      {max && <li><strong>Max:</strong> <code>{max}</code></li>}
      <li><strong>Scope:</strong> <a href="/doc/api-reference/api-parameters"><code>{scope}</code></a></li>
      {formerly && <li>
          <strong>Deprecated name:</strong> <code>{formerly}</code>
        </li>}
    </ul>;
};

<Setting type="object" default="{}" scope="settings" />

The `decompoundedAttributes` parameter defines which attributes should support **compound word segmentation**,
or **decompounding**, for supported languages.

Decompounding splits long compound words—common in Germanic and Scandinavian languages—into individual word components.\
For example, the German word `"Gartenstühle"` is split into `"Garten"` and `"Stühle"` so that a query for `"Stühle"` can match `"Gartenstühle"`.

## Usage

* Attribute names are case-sensitive.

* The attributes must be included in [`searchableAttributes`](/doc/api-reference/api-parameters/searchableAttributes).

* You can define different attributes for different languages.

* Decompounding is available for:

  * Danish (`da`)
  * Dutch (`nl`)
  * Finnish (`fi`)
  * German (`de`)
  * Norwegian (`no`)
  * Swedish (`sv`)

* doesn't apply to decomposed characters using non-spacing marks.
  For example, `"Gartenstühle"` (composed of `u` + `◌̈`) won't be split.

## Example

<AccordionGroup>
  <Accordion title="Current API clients" defaultOpen="true">
    <CodeGroup>
      ```cs C# theme={"system"}
      var response = await client.SetSettingsAsync(
        "INDEX_NAME",
        new IndexSettings
        {
          DecompoundedAttributes = new Dictionary<string, List<string>>
          {
            {
              "de",
              new List<string> { "name" }
            },
          },
        }
      );
      ```

      ```dart Dart theme={"system"}
      final response = await client.setSettings(
        indexName: "INDEX_NAME",
        indexSettings: IndexSettings(
          decompoundedAttributes: {
            'de': [
              "name",
            ],
          },
        ),
      );
      ```

      ```go Go theme={"system"}
      response, err := client.SetSettings(client.NewApiSetSettingsRequest(
        "INDEX_NAME",
        search.NewEmptyIndexSettings().SetDecompoundedAttributes(map[string]any{"de": []string{"name"}})))
      if err != nil {
        // handle the eventual error
        panic(err)
      }
      ```

      ```java Java theme={"system"}
      UpdatedAtResponse response = client.setSettings(
        "INDEX_NAME",
        new IndexSettings().setDecompoundedAttributes(
          new HashMap() {
            {
              put("de", Arrays.asList("name"));
            }
          }
        )
      );
      ```

      ```js JavaScript theme={"system"}
      const response = await client.setSettings({
        indexName: 'theIndexName',
        indexSettings: { decompoundedAttributes: { de: ['name'] } },
      });
      ```

      ```kotlin Kotlin theme={"system"}
      var response =
        client.setSettings(
          indexName = "INDEX_NAME",
          indexSettings =
            IndexSettings(
              decompoundedAttributes =
                buildJsonObject { put("de", JsonArray(listOf(JsonPrimitive("name")))) }
            ),
        )
      ```

      ```php PHP theme={"system"}
      $response = $client->setSettings(
          'INDEX_NAME',
          ['decompoundedAttributes' => ['de' => [
              'name',
          ],
          ],
          ],
      );
      ```

      ```python Python theme={"system"}
      response = client.set_settings(
          index_name="INDEX_NAME",
          index_settings={
              "decompoundedAttributes": {
                  "de": [
                      "name",
                  ],
              },
          },
      )
      ```

      ```ruby Ruby theme={"system"}
      response = client.set_settings(
        "INDEX_NAME",
        Algolia::Search::IndexSettings.new(decompounded_attributes: {de: ["name"]})
      )
      ```

      ```scala Scala theme={"system"}
      val response = Await.result(
        client.setSettings(
          indexName = "INDEX_NAME",
          indexSettings = IndexSettings(
            decompoundedAttributes = Some(JObject(List(JField("de", JArray(List(JString("name")))))))
          )
        ),
        Duration(100, "sec")
      )
      ```

      ```swift Swift theme={"system"}
      let response = try await client.setSettings(
          indexName: "INDEX_NAME",
          indexSettings: IndexSettings(decompoundedAttributes: ["de": ["name"]])
      )
      ```
    </CodeGroup>
  </Accordion>

  <Accordion title="Legacy API clients">
    <CodeGroup>
      ```cs C# theme={"system"}
      IndexSettings settings = new IndexSettings();
      settings.DecompoundedAttributes = new Dictionary>
      {
          {"de", new List {"name_de", "description_de"}},
          {"fi", new List {"name_fi", "description_fi"}}
      };

      index.SetSettings(settings);
      ```

      ```go Go theme={"system"}
      res, err := index.SetSettings(search.Settings{
      	DecompoundedAttributes: opt.DecompoundedAttributes(map[string][]string{
      		"de": {"name_de", "description_de"},
      		"fi": {"name_fi", "description_fi"},
      	}),
      })
      ```

      ```java Java theme={"system"}
      Map> decompoundedAttributes = new HashMap<>();
      decompoundedAttributes.put(
              "de",
              Arrays.asList(
                      "name_de",
                      "description_de"
              )
      );

      decompoundedAttributes.put(
              "fi",
              Arrays.asList(
                      "name_fi",
                      "description_fi"
              )
      );

      index.setSettings(
              new IndexSettings().setDecompoundedAttributes(decompoundedAttributes)
      );
      ```

      ```js JavaScript theme={"system"}
      index
        .setSettings({
          decompoundedAttributes: {
            de: ["name_de", "description_de"],
            fi: ["name_fi", "description_fi"],
          },
        })
        .then(() => {
          // done
        });
      ```

      ```php PHP theme={"system"}
      $index->setSettings([
        'decompoundedAttributes' => [
          'de' => [
            'name_de',
            'description_de'
          ],
          'fi' => [
            'name_fi',
            'description_fi'
          ]
        ]
      ]);
      ```

      ```python Python theme={"system"}
      index.set_settings(
          {
              "decompoundedAttributes": {
                  "de": ["name_de", "description_de"],
                  "fi": ["name_fi", "description_fi"],
              }
          }
      )
      ```

      ```ruby Ruby theme={"system"}
      index.set_settings(
        {
          decompoundedAttributes: {
            de: [
              "name_de",
              "description_de"
            ],
            fi: [
              "name_fi",
              "description_fi"
            ]
          }
        }
      )
      ```

      ```scala Scala theme={"system"}
      val decompoundedAttributes = Map(
        "de" -> List("name_de", "description_de")
        "fi" -> List("name_fi", "description_fi")
      )

      client.execute {
        setSettings of "myIndex" `with` IndexSettings(
          customSettings = Some(
            Map("decompoundedAttributes" -> decompoundedAttributes)
          )
        )
      }
      ```

      ```swift Swift theme={"system"}
      let settings = Settings()
        .set(\.decompoundedAttributes, to: [
          .german: ["description_de", "name_de"],
          .finnish: ["name_fi", "description_fi"]
        ])

      index.setSettings(settings) { result in
        if case .success(let response) = result {
          print("Response: \(response)")
        }
      }
      ```
    </CodeGroup>
  </Accordion>
</AccordionGroup>
