Indexing
...
Entities
Discovery

Is Indexable Determiner

3min

Determiners

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

All entity types module-ms-indexing-categories, module-ms-indexing-cms and module-m2-indexing-products create virtualTypes of this class and inject an array of determiners. e.g. for products the virtualType in di.xml looks like this

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 index products when the attribute color was pink. You’d inject your determiner in to the IsIndexableDeterminer via the isIndexableDeterminers array in your di.xml

Vendor/Module/etc/di.xml


Create that class, which must implement the IsIndexableDeterminerInterface

Vendor/Module/Service/Determiner/PinkProductIsIndexableDeterminer.php


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

Updated 23 Sep 2024
Doc contributor
Doc contributor
Did this page help you?