Indexing
...
Attributes
Discovery
Is Indexable Determiner
4min
determiners & conditions if an attribute is indexable is determined by klevu\indexing\service\determiner\isattributeindexabledeterminer this determiner loops through all injected klevu\indexingapi\service\determiner\isattributeindexableconditioninterface 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 both module ms indexing categories and module m2 indexing products create virtual types of this class and inject an array of conditions e g module m2 indexing products/etc/di xml \<virtualtype name="klevu\indexingproducts\service\determiner\isattributeindexabledeterminer" type="klevu\indexing\service\determiner\isattributeindexabledeterminer"> \<arguments> \<argument name="isindexableconditions" xsi\ type="array"> \<item name="indextypeisindexablecondition" xsi\ type="object">klevu\indexingproducts\service\determiner\attributeisindexablecondition\</item> \</argument> \</arguments> \</virtualtype> custom conditions you can add conditions 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 condition in to the isattributeindexabledeterminer via the isindexableconditions array in your di xml vendor/module/etc/di xml \<virtualtype name="klevu\indexingproducts\service\determiner\isattributeindexabledeterminer"> \<arguments> \<argument name="isindexableconditions" xsi\ type="array"> \<item name="indextypeisindexablecondition" xsi\ type="object">vendor\module\service\determiner\attributecodebeginswithisindexablecondition\</item> \</argument> \</arguments> \</virtualtype> create that class implementing the interface klevu\indexingapi\service\determiner\isattributeindexableconditioninterface vendor/module/service/determiner/attributecodebeginswithisindexablecondition php \<?php namespace vendor\module\service\determiner; use klevu\indexingapi\service\determiner\isattributeindexableconditioninterface; class attributecodebeginswithisindexablecondition implements isattributeindexableconditioninterface { public function execute( attributeinterface $attribute, storeinterface $store ) bool { return str starts with( haystck $attribute >getcode(), needle 'vendor ', ); } } see klevu\indexingproducts\service\determiner\attributeisindexablecondition as an example of a condition