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

Can be used in these methods:

About this parameter

List of attributes for which you want to turn off prefix matching.

Use this parameter to ensure specific attributes, such as phone numbers and SKUs, only return exact matches.

Usage notes

  • searchableAttributes must not be empty or null for disablePrefixOnAttributes to be applied.
  • The list must be a subset of the searchableAttributes index setting.
  • Attribute names are case-sensitive.

While there’s no limit to the number of attributes, adding too many attributes can slow down calls to getSettings and reduce the responsiveness of Algolia’s dashboard.

Examples

Disable prefix search for some attributes by default

1
2
3
4
5
$index->setSettings([
  'disablePrefixOnAttributes' => [
    'sku',
  ]
]);
Did you find this page helpful?