Indexing
...
Sync
Pipelines

Pipelines Customisation

17min

Making customisations to existing Klevu pipelines.

Before adding attributes to your pipeline YAML, please ensure they have been registered with Klevu.

Adding Pipeline Stages

Note: All these examples could be combined into one pipelineConfigurationOverrideFilepaths file.

They have been split into multiple files to make it easier to read.

Example 1:

Add meta_description and meta_title to the default (simple, virtual, downlaodable product types) product data during the Add action.

First, in your module add or update etc/di.xml. Add a virtual type for Klevu\IndexingProducts\Service\EntityIndexerService\Add and pass in an array of pipelineConfigurationOverrideFilepaths

Vendor/Module/etc/di.xml


If the same changes are required during an Update (almost always the case) then we’d also make the same change to Klevu\IndexingProducts\Service\EntityIndexerService\Update

Vendor/Module/etc/di.xml


Create the YAML file.

Vendor/Module/etc/pipeline/add_update_default.yml


And add the 2 referenced file (this code could also be added to the above YAML, but it is more readable when split into multiple files)

Vendor/Module/etc/pipeline/product/attributes/meta_description.yml

Vendor/Module/etc/pipeline/product/attributes/meta_description.yml


Example 2:

Add color and size to configurable variant product data during the sync action.

First, in your module add or update etc/di.xml. Add a virtual type Klevu\IndexingProducts\Service\EntityIndexerService\Add and pass in an array of pipelineConfigurationOverrideFilepaths

Vendor/Module/etc/di.xml


If the same changes are required during an Update then we’d also make this change to Klevu\IndexingProducts\Service\EntityIndexerService\Update

Vendor/Module/etc/di.xml


Create the YAML file.

Vendor/Module/etc/pipeline/add_update_variant.yml


And add the 2 referenced file (this code could also be added to the above YAML, but it is more readable when split into multiple files)

Vendor/Module/etc/pipeline/product/attributes/color.yml

Vendor/Module/etc/pipeline/product/attributes/color.yml



Updating Existing Pipeline Stages

This works the same as adding a new pipeline stage. In this example, we will append extra data to the description.

First, in your module add or update etc/di.xml. Add a virtual type Klevu\IndexingProducts\Service\EntityIndexerService\Add and pass in an array of pipelineConfigurationOverrideFilepaths

Vendor/Module/etc/di.xml


If the same changes are required during an Update then we’d also make this change to Klevu\IndexingProducts\Service\EntityIndexerService\Update

Vendor/Module/etc/di.xml


Create the YAML file.

Vendor/Module/etc/pipeline/add_update_default.yml


Append the product name and sku to the end of the description

Vendor/Module/etc/pipeline/product/attributes/description.yml



Removing Pipeline Stages

In this example, we will remove the rating and rating count from any configurable variant so indexing falls back to using the parent values

First, in your module add or update etc/di.xml. Add a virtual type Klevu\IndexingProducts\Service\EntityIndexerService\Add and pass in an array of pipelineConfigurationOverrideFilepaths

Vendor/Module/etc/di.xml


If the same changes are required during an Update then we’d also make this change to Klevu\IndexingProducts\Service\EntityIndexerService\Update

Vendor/Module/etc/di.xml


Create the injected customisation YAML file

Vendor/Module/etc/pipeline/add_update_variant.yml



Example Module

An example module with YAML files for common attributes that could be useful. Contains examples of how to:

  • change data synced for existing attributes
  • add stages to pipelines
  • add different attributes for different products types.
  • add new product types
  • remove attributes
  • remove attributes from data if some condition is met (in this case if the value is null)

List of attribute YAML files present in the module

  • color
  • gender
  • manufacturer
  • meta_description
  • meta_keywords
  • meta_title
  • new
  • sale
  • size
  • weight

This is not a production ready module and is intended as an example only.

Do not install this module in a production environment.