decompoundQuery
true
'decompoundQuery' => true
Can be used in these methods:
search,
setSettings,
browseObjects,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
search,
set_settings,
browse_objects,
search_for_facet_values,
generate_secured_api_key,
add_api_key,
update_api_key
search,
setSettings,
browseObjects,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
search,
set_settings,
browse_objects,
search_for_facet_values,
generate_secured_api_key,
add_api_key,
update_api_key
search,
setSettings,
browse,
searchForFacetValues,
generateSecuredApiKey,
addAPIKey,
updateAPIKey
search,
setSettings,
browseObjects,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
Search,
SetSettings,
Browse,
SearchForFacetValues,
GenerateSecuredApiKey,
AddApiKey,
UpdateApiKey
Search,
setSettings,
browse,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
Search,
SetSettings,
BrowseObjects,
SearchForFacetValues,
GenerateSecuredAPIKey,
AddAPIKey,
UpdateAPIKey
search,
setSettings,
browse index,
search into facet values,
generateSecuredApiKey,
add key,
update key
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
istrue
, 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 setdecompoundQuery
totrue
as it leads to better matching and relevance. - If
decompoundQuery
isfalse
, 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”. SetdecompoundQuery
tofalse
to enforce exact matches for compound words. For example, for product names or legal terms.
Usage notes
- Decompounding doesn’t work if words contain non-spacing mark Unicode characters. For example,
Gartenstühle
won’t be decompounded if theü
consists ofu
(U+0075) and◌̈
(U+0308). - See also:
decompoundedAttributes
.
Examples
Enable splitting compound words by default
1
2
3
$index->setSettings(array(
'decompoundQuery' => true,
));
Enable splitting compound words for the current search
1
2
3
$res = $index->search('query string', [
'decompoundQuery' => true
]);