relevancyStrictness
100
'relevancyStrictness' => relevancy_strictness
Can be used in these methods:
search,
setSettings,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
search,
set_settings,
search_for_facet_values,
generate_secured_api_key,
add_api_key,
update_api_key
search,
setSettings,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
search,
set_settings,
search_for_facet_values,
generate_secured_api_key,
add_api_key,
update_api_key
search,
setSettings,
searchForFacetValues,
generateSecuredApiKey,
addAPIKey,
updateAPIKey
search,
setSettings,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
Search,
SetSettings,
SearchForFacetValues,
GenerateSecuredApiKey,
AddApiKey,
UpdateApiKey
Search,
setSettings,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
Search,
SetSettings,
SearchForFacetValues,
GenerateSecuredAPIKey,
AddAPIKey,
UpdateAPIKey
search,
setSettings,
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. relevancyStrictness
isn’t supported for browse.- 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: From the attributes that you list in the Relevant sort
customRanking
, besides relevancy and sort results the engine also returns results up topaginationLimitedTo
provided there is no timeout.
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
]);