API Reference / API Parameters / numericAttributesForFiltering
Type: list of strings
Engine default: null (all numeric attributes)
Formerly: numericAttributesToIndex
Parameter syntax
'numericAttributesForFiltering' => [
  'attribute1',
  'equalOnly(attribute2)'
]

Can be used in these methods:

About this parameter

List of numeric attributes that can be used as numerical filters.

By default, all numeric attributes are automatically indexed and available as numerical filters. For faster indexing, it is best to reduce the number of numeric attributes used for filtering. This setting enables you to do this.

Usage notes

  • If a list of attributes is specified, only those attributes listed are available as numerical filters.
  • If you provide an empty list or null, then all numeric attributes are filterable.
  • If you want to disable filtering for all numeric attributes, specify an attribute that does not exist, e.g. _no_numeric_attributes_.
  • Attribute names are case-sensitive

Modifiers

equalOnly

If you only need to filter on a numeric value based on equality (i.e. with the operators = or !=), you can use this modifier. All other operators will be disabled.

Examples

Set list of numeric attributes that can be used as numerical filters.

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