API Reference / API Parameters / attributeCriteriaComputedByMinProximity


Type: boolean
Engine default: false
Parameter syntax
'attributeCriteriaComputedByMinProximity' => true|false

Can be used in these methods:

About this parameter

When the Attribute criterion is ranked higher than Proximity in your ranking formula, Proximity selects which searchable attribute is matched in the Attribute criterion.

Usage notes

This parameter only affects relevance when Attribute comes before Proximity in the ranking formula. By default, this isn’t the case: searches that match several searchable attributes are ranked by the best-matched attribute (depending on the order of searchable attributes). If you set attributeCriteriaComputedByMinProximity to true, the matched attribute is selected based on minimum proximity.

For example, consider an index of books with searchable attributes for title, author, and description (in that order), and where you’ve changed the ranking formula so that Attribute comes before Proximity. If the search for a book matches on both its title, with a proximity of 6, and description, with a proximity of 1, then title is the best-matched attribute even though description has a better proximity score. Setting attributeCriteriaComputedByMinProximity to true computes the best-matched attribute based on minimum proximity; in this case, description is used instead of title.


Sets attributeCriteriaComputedByMinProximity to true for an index

  'attributeCriteriaComputedByMinProximity' => true
Did you find this page helpful?