Algolia DevCon
Oct. 2–3 2024, virtual.
API Reference / API Parameters / decompoundQuery
Type: boolean
Engine default: true
Parameter syntax
'decompoundQuery' => true

Can be used in these methods:

About this parameter

Splits compound words into constituent parts in the query.

For certain queryLanguages (German, Dutch, Finnish, Danish, Swedish, and Norwegian), compound word segmentation splits compound words into constituent parts.

  • If decompoundQuery is true, compound words in the query are split into constituent parts. This will increase the likelihood of finding relevant matches because Algolia will look for records that contain any of the word’s parts. For example, if users search for “schoolboeken” (Dutch for “school books”), Algolia looks for records that contain the words “schoolboeken”, “school”, and “boeken”. You should usually set decompoundQuery to true as it leads to better matching and relevance.
  • If decompoundQuery is false, compound words in the search query aren’t split. For example, if users search for “gartenstühle” (German for “garden chairs”), Algolia won’t look for records that contain the words “garten” and “stühle”. Set decompoundQuery to false to enforce exact matches for compound words. For example, for product names or legal terms.

Usage notes

Examples

Enable splitting compound words by default

1
2
3
$index->setSettings(array(
  'decompoundQuery' => true,
));
1
2
3
$res = $index->search('query string', [
  'decompoundQuery' => true
]);
Did you find this page helpful?