API Reference / API Parameters / disableExactOnAttributes
Type: list of strings
Engine default: []
Parameter syntax
'disableExactOnAttributes' => [
  'attribute',
  ...
]

Can be used in these methods:

About this parameter

List of attributes on which you want to disable the exact ranking criterion.

Usage notes:

  • The list must be a subset of the searchableAttributes index setting.
  • The searchableAttributes setting must not be empty nor null for disableExactOnAttributes to be applied.
  • This attribute is useful for longer or noisy attributes like “description” or “content”. In these attributes the exact ranking criterion can play an outsized role because matches can be alternative versions of query terms. When exact matches do occur in these attributes, the engine boosts these records though they might not be more relevant than those with non-exact matches. Disabling exact on these attributes can reduce these false positives without having to disable exact for the entire search.
  • Conversely, disabling exact on succinct or precise attributes like “keywords” generally doesn’t help relevance, since matches are more likely to be exact between queries and these attributes.

Examples

Disable exact ranking criterion for some attributes by default

1
2
3
4
5
$index->setSettings([
  'disableExactOnAttributes' => [
    'description',
  ]
]);
1
2
3
4
5
$results = $index->search('query', [
  'disableExactOnAttributes' => [
    'description'
  ]
]);

Did you find this page helpful?