API Reference / API Parameters / relevancyStrictness
Type: integer
Engine default: 100
Parameter syntax
'relevancyStrictness' => relevancy_strictness

Can be used in these methods:
search, setSettings, searchForFacetValues, generateSecuredApiKey, addApiKey, updateApiKey

About this parameter# A

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 to paginationLimitedTo provided there is no timeout.

Examples# A

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
]);
Did you find this page helpful?
PHP v3