Custom indexer plugin for eContent¶
The following example shows how to create a plugin for eContent that indexes an additional field based on a serialised array that comes from the database.
The database stores keys and values for the articles. They come in a serialised format, for example:
The indexer creates the following output:
- Index field
additional_product_codewith value "AXW"
- Index field
additional_product_namewith value "Awesome Speaker AX50"
Create a plugin class¶
Create a plugin class that implements
1 2 3 4 5 6
Create a service definition¶
You must register the class as a service:
1 2 3 4 5
Create custom logic¶
In your custom logic, you have to loop through the product data map.
eContent data map supports the following data types:
- strings, stored in a
- integers, stored in a
- floats, stored in a
For array support use serialised arrays.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
This creates two new Solr fields with the following names and values:
- The prefix (here
ses_product_ses_datamap_ext_) is added automatically and contains the Content Type (here
product) as well
- The suffix
_sis added because the indexer detects the value as a string. The indexer also supports these additional data types with the corresponding suffix:
|Array (Multiple strings)||
The data type is specified in
Long data types
Solr accepts the following min and max integer values:
After executing the indexer command line, you should be able to see the new indexed content in Solr.
For instructions about running the eContent indexer, see Indexing econtent data.