Indexing
...
Entities
Discovery

Is Indexable Determiner

3min

Determiners & Conditions

If an entity is indexable is determined by Klevu\Indexing\Service\Determiner\IsIndexableDeterminer This determiner loops through all injected Klevu\IndexingApi\Service\Determiner\IsIndexableConditionInterface 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 conditions. e.g. for products the virtualType in di.xml looks like this

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



Custom Conditions

You can add conditions to amend the default behaviour. Let's say you only wanted to index products when the attribute color was pink. You’d inject your condition in to the IsIndexableDeterminer via the isIndexableConditions array in your di.xml

Vendor/Module/etc/di.xml


Create that class, which must implement the IsIndexableConditionInterface

Vendor/Module/Service/Determiner/PinkProductIsIndexableCondition.php


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

Updated 12 Nov 2024
Doc contributor
Doc contributor
Did this page help you?