maxValuesPerFacet
'maxValuesPerFacet' => max_value
Can be used in these methods:
search,
setSettings,
browseObjects,
generateSecuredApiKey,
addApiKey,
updateApiKey
search,
set_settings,
browse_objects,
generate_secured_api_key,
add_api_key,
update_api_key
search,
setSettings,
browseObjects,
generateSecuredApiKey,
addApiKey,
updateApiKey
search,
set_settings,
browse_objects,
generate_secured_api_key,
add_api_key,
update_api_key
search,
setSettings,
browse,
generateSecuredApiKey,
addAPIKey,
updateAPIKey
search,
setSettings,
browseObjects,
generateSecuredApiKey,
addApiKey,
updateApiKey
Search,
SetSettings,
Browse,
GenerateSecuredApiKey,
AddApiKey,
UpdateApiKey
Search,
setSettings,
browse,
generateSecuredApiKey,
addApiKey,
updateApiKey
Search,
SetSettings,
BrowseObjects,
GenerateSecuredAPIKey,
AddAPIKey,
UpdateAPIKey
search,
setSettings,
browse index,
generateSecuredApiKey,
add key,
update key
About this parameter
The maximum number of facet values to return for each facet in a regular search.
To set the number of facet values returned in a regular search use maxValuesPerFacet
but to set the maximum number of hits to return in a searchForFacetValues
, use maxFacetHits
, instead.
Usage notes
For performance reasons, the maximum value for maxValuesPerFacet
is 1,000. You can set it higher but the engine will interpret it as 1,000 .
Examples
Set the default number of facet values to retrieve
For example, if an ecommerce site has 443 different phone brands, and a user searches for “phone”, this default setting will only return the top 100 brands.
1
2
3
$index->setSettings([
'maxValuesPerFacet' => 100
]);
Set the maximum number of facet values for the current query
This search setting will override the default maxValuesPerFacet
but just for the current search. For example, on an ecommerce site, if a user searches for “iphone”, this setting will only return the top 20 iPhone brands.
1
2
3
$results = $index->search('query', [
'maxValuesPerFacet' => 20
]);