Indexing
...
Sync
Pipelines

Pipelines Customisation

18min

Making customisations to existing Klevu pipelines.

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

Note: any customisations made via these methods will override the auto-generated pipeline configuration files found in var/klevu/indexing/pipeline

During development, it may be useful to edit (in a non-production environment) these auto-generated YAML files to test out customisations before copying the YAML to a custom override file.

These files will be regenerated and can be deleted once the customisation override has been created.

Adding Pipeline Stages

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

They have been split into multiple files, as we do in the modules, to make them easier to read.

Example 1:

Add meta_description and meta_title to the default (simple, virtual, downloadable 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\Provider\PipelineConfigurationOverridesFilepathsProvider\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\Provider\PipelineConfigurationOverridesFilepathsProvider\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\Provider\PipelineConfigurationOverridesFilepathsProvider\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\Provider\PipelineConfigurationOverridesFilepathsProvider\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\Provider\PipelineConfigurationOverridesFilepathsProvider\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\Provider\PipelineConfigurationOverridesFilepathsProvider\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\Provider\PipelineConfigurationOverridesFilepathsProvider\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\Provider\PipelineConfigurationOverridesFilepathsProvider\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.