Indexing
...
Attributes
Discovery

Is Indexable Determiner

4min

Determiners

If an attribute is indexable is determined by Klevu\Indexing\Service\Determiner\IsAttributeIndexableDeterminer This determiner loops through all injected Klevu\IndexingApi\Service\Determiner\IsAttributeIndexableDeterminerInterface classes. If any of these return false; then the attribute is set to not indexable and will not be registered with Klevu. If they all return true; then the attribute is indexable and can be registered with Klevu.

By default, the only setting checked to determine if an attribute is indexable is the new Register with Klevu setting on the attribute.

Klevu Attribute Settings
Klevu Attribute Settings


Both module-ms-indexing-categories and module-m2-indexing-products create virtual types of this class and inject an array of determiners. e.g.

module-m2-indexing-products/etc/di.xml



Custom Determiners

You can add determiners to amend the default behaviour. Let's say you only wanted to register attributes when the attribute code began with vendor_. You’d inject your determiner in to the IsAttributeIndexableDeterminer via the isIndexableDeterminers array in your di.xml

Vendor/Module/etc/di.xml


Create that class implementing the interface Klevu\IndexingApi\Service\Determiner\IsAttributeIndexableDeterminerInterface

Vendor/Module/Service/Determiner/AttributeCodeBeginsWithIsIndexableDeterminer.php


See Klevu\IndexingProducts\Service\Determiner\AttributeIsIndexableDeterminer as an example of a determiner.