Extending the HCL Commerce Search base index schema
The base index schema can be extended to suit your business needs. For example, to separate data into different indexes that are based on their refresh intervals.
It can be extended by creating a new separate index schema and linking it to the base index. In some cases, it is more desirable to separate data into different indexes. In this scenario, you create a new separate index schema and link it to the base index.
For example, the product base index is used to store static data for the product, such as product identifier, name, and short description. These values typically do not change often. However, dynamic information such as product inventory or ratings change more frequently. Therefore, it is put into a separate index, where it can be refreshed at different intervals than the base product index.
- The extension index artifacts must be created first, and placed in a specific directory under
the deployed Solr home directory. The extension index schema structure is defined in the Solr
schema.xml configuration file.
For the base index to be able to reference an extension index, the extension index schema must define what is similar to a foreign key that matches the unique field name and type in the base index schema. The referenced field data type must be a simple data type such as String, Integer, or float. It must match the unique key name and type of the base index.
Avoid common field names between extension indexes and the base index, other than the referenced field. It is recommended to use a naming convention that prefixes the extension index fields to avoid naming collisions.
- The extension index cores must be registered under the solr.xml file, as the Solr server loads indexes registered under the solr.xml file. This file also contains the mapping between the base index and extension index.
- The extension index must be registered in the HCL Commerce database. The HCL Commerce run time looks up all Solr indexes that are registered in the SRCHCONFEXT table. Extension indexes are registered as index subtypes of the base index.
Procedure
-
Create the extension index in the Solr server.
-
Register the extension index in the solr.xml file.
-
Register the extension index core into the SRCHCONFEXT table.
INSERT INTO srchconfext (srchconfext_id,indextype,indexscope,indexsubtype,config) VALUES(-100,'CatalogEntry','10001','Ranking','SearchServerName=localhost,SearchServerPort=80');
- Restart the test server.
-
Verify the extension index at the following URL:
- http://localhost/solr/MC_10001_CatalogEntry_Ranking_generic/select?q=*
<?xml version="1.0" encoding="UTF-8"?> -<response> -<lst name="responseHeader"> <int name="status">0</int> <int name="QTime">62</int> -<lst name="params"> <str name="q">*</str> </lst> </lst> <result name="response" start="0" numFound="0"/> </response>
What to do next
To work with an inventory index in HCL Commerce Search, complete the following tutorial: Setting up and building the inventory index.