🎉 Try the public beta of the new docs site at algolia.com/doc-beta! 🎉
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.

There’s no limit to the number of attributes in the list, but having many attributes slows down calls to getSettings. This can make the Algolia dashboard slower and less responsive.

Examples

Disable prefix search for some attributes by default

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