relevancyStrictness
100
'relevancyStrictness' => relevancy_strictness
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
searchAsync,
setSettingsAsync,
browseAsync,
searchForFacetValues
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
Controls the relevancy threshold below which less relevant results aren’t included in the results.
Usage notes:
relevancyStrictness
is available on applications having the Relevant sort feature enabled.- You can set
relevancyStrictness
on virtual replicas only. - The value must be an integer between 0 and 100 (inclusive).
By default, this parameter is set to 100, which is the maximum value to offer a relevant sort. If this behavior isn’t suited for you and to know what value works best for your use-case, you can:
- Test your top queries with different values of
relevancyStrictness
until you’re satisfied with the balance between the relevancy of results and the number of returned hits. - If you have enough traffic on your sort, you can start an A/B test to test different values of
relevancyStrictness
and see which one works best.
Options:
-
100: The default value of
100
means that the engine only returns and sorts the top relevant results. -
90: Returns hits with 90% similarity as compared to the most relevant hit.
-
0: The engine doesn’t consider relevancy and sorts results only on the attributes you list in the Relevant sort
customRanking
. It returns results up topaginationLimitedTo
.
Examples
Set the default relevancy strictness for an index with Relevant sort
1
2
3
$index->setSettings([
'relevancyStrictness' => 90
]);
Override the default relevancy strictness for the current search
1
2
3
$results = $index->search('query', [
'relevancyStrictness' => 70
]);