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

Can be used in these methods:

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

Examples

Set the default relevancy strictness for an index with Relevant sort

1
2
3
$index->setSettings([
  'relevancyStrictness' => 90
]);
1
2
3
$results = $index->search('query', [
  'relevancyStrictness' => 70
]);
Did you find this page helpful?