API Reference / API Parameters / decompoundedAttributes
Jan. 14, 2019

decompoundedAttributes

Type: object
Engine default: (no decompounded attribute)
Parameter syntax
'decompoundedAttributes' => [
  ['2-character country code' => ['attribute', 'attribute']],
  ['2-character country code' => ['attribute', 'attribute']],
  ...
]

Can be used in these methods:

About this parameter

Specify on which attributes in your index Algolia should apply word-splitting (“decompounding”).

A compound word refers to a word that is formed by combining smaller words without spacing. They are called noun phrases, or nominal groups, and they are particularly present in German. An example is Baumhaus, which is a contraction of Baum and Haus.

The goal of decompounding, regarding the previous example, is to index both Baum and Haus separately, instead of as a single word.

Usage notes:

  • You can specify different attributes for each language.

  • As of today, the setting supports only three languages: Dutch (nl), German (de) and Finnish (fi).

  • Note The attributes listed must have been defined by searchableAttributes.

Examples

Enable word decompounding for one language

In this example we consider an index having only one language (de) and where we want to decompound only the attribute name

1
2
3
4
5
6
7
$index->setSettings([
  'decompoundedAttributes' => [
    'de' => [
      'name'
    ]
  ]
]);

Enable word decompounding for several languages

In this example we consider an index containing two languages (de, fi) in different attributes and where we want to decompound name and description for both languages.

1
2
3
4
5
6
7
8
9
10
11
12
$index->setSettings([
  'decompoundedAttributes' => [
    'de' => [
      'name_de',
      'description_de'
    ],
    'fi' => [
      'name_fi',
      'description_fi'
    ]
  ]
]);

Did you find this page helpful?