'decompoundedAttributes' => [ ['2-character country code' => ['attribute', 'attribute']], ['2-character country code' => ['attribute', 'attribute']], ... ]
About this parameter
Specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding.
A compound word refers to a word that is formed by combining smaller words without spacing.
They’re called noun phrases, or nominal groups, and are particularly present in Germanic and Scandinavian languages. An example is the German “Gartenstühle,” which is a contraction of “Garten” and “Stühle.”
The goal of decompounding, regarding the previous example, is to index both “Garten” and “Stühle” separately, instead of together as a single word. This way, if a user searches for “Stühle”, Algolia returns results with “Gartenstühle” and other “Stühle”, for example “Polsterstühle”, “Bürostühle”, etc.
You can specify different attributes for each language.
As of today, the setting supports only six languages: Dutch (
nl), German (
de), Finnish (
fi), Danish (
da), Swedish (
sv) and Norwegian Bokmål (
Note The attributes listed must have been defined by
Enable word decompounding for one language
This example considers an index having only one language (
de) and where the goal is to decompound only the attribute
1 2 3 4 5 6 7 $index->setSettings([ 'decompoundedAttributes' => [ 'de' => [ 'name' ] ] ]);
Enable word decompounding for several languages
This example considers an index containing two languages (
fi) in different attributes and where the goal is to decompound
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' ] ] ]);