Custom Data
Add custom or external data to your index.
Last updated
Was this helpful?
Add custom or external data to your index.
Last updated
Was this helpful?
If you wish to add custom or external data to your index, Ucommerce provides the interface IAdorn<T>
where T
is the search model type, e.g. ProductSearchModel
. The interface provides 2 methods, one for general properties and one for language-specific (multilingual) properties:
You cannot store nested data structures; for instance, you cannot store a list of product relationships, each with its list of products. If you require such flexibility, you will need to create your own search model.
Below is an example of an adorner that adds the product id to the product index.
It is not recommended to use the id externally. This is also the reason the id is not part of the search model.
The below adorner is not meant for production as it is not very performant to make a database call for each product to get the id.
To register your adorner, add it to the service collection like this:
Remember to check that the property is part of the index definition, otherwise add it:
A rebuild of the indices is needed after changing the index definition.