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:

  • Acceptable values:

    • If a list of attributes is specified, only those attributes listed are available as numerical filters.

    • If you provide an empty list, no numerical filters are allowed.

    • If you specify the setting with null, then all numeric attributes are filterable. Use this to reset filtering back to all.

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?