Next >Tutorial: Indexing external data in WebSphere Commerce search
(Developer) In this tutorial, you add the ability to index data from a data source that is external to the WebSphere Commerce database. You then add Management Center support for ranking product search results based on the indexed customer ratings data. In this tutorial, your external source data is product ratings from customers.
Through customization of the indexing process, you add data to the search index to enable searching on the customer ratings data. Newly added search fields are used as ranking fields to sort the search results when creating our search rules. Search rules provide ways to manipulate the ordering and ranking of search results in starter stores, where the new ranking field is used as a sort criteria.
Note: Some extensions used in this tutorial contain an X_ prefix. This naming convention prevents naming conflicts between customization properties and default WebSphere Commerce properties. The indexing process in WebSphere Commerce search is divided into two stages:
- Preprocessing, where the highly structured relational data is flattened and stored in summary tables.
- The actual indexing, where data is extracted from the flattened tables and sent to the Solr indexes.
This two-stage process provides a customization point that allows external data to be added to the index during the preprocessing stage. To configure the preprocessing stage, you use the preprocessing configuration extensions to create temporary tables to hold the external ratings data, which is used in the full index build. We must create the Java extension classes for loading the product ratings data from the XML file containing the externally sourced data into the temporary tables.
We must customize the index building process to include data from the temporary tables into the search index. To customize this process, you configure the DIH configuration file to associate the new table data with the existing data before indexing. Once the indexing process is customized to include the external data in the search index, you add support for using the data in a sorting filter in the Management Center.
To display the ratings data in the storefront and use it in the sorting filter, the new ranking field must be added to the mediator configuration file. You configure the new ranking field to map the fields into the UserData within the CatalogNavigationViewType noun, the noun used for search results. With the mapping complete, the fields can be extracted for display in the store. The following diagram illustrates this process:
![]()
Note: Workspaces are not supported when we are completing this tutorial.
Learning objectives
After completing this tutorial, you should be familiar with indexing and with the following tasks:
- Understand and customize WebSphere Commerce search
- Understand and customize the preprocessing and indexing process
Time required
Expect this tutorial to take 2 hours to complete. The tutorial can take longer if you explore concepts related to this tutorial.
Skill level
This tutorial is intended for advanced WebSphere Commerce developers responsible for creating and customizing WebSphere Commerce BOD services. Ensure that we are familiar with the following terms and concepts before you begin this tutorial:
- WebSphere Commerce search
- WebSphere Commerce services
- XML
- Relational databases
- SQL
System requirements
Before starting this tutorial, complete the following tasks in your development environment:
- Deploy the WebSphere Commerce search server. See Deploying a WebSphere Commerce live environment with Docker Compose.
- Populate and build the search index.
Tutorial resources
Download and extract the following compressed file into a temporary directory in your development environment.
Lessons in this tutorial
- Extend the catalog entry search index schema
- Configure the search preprocessor
- Configure the Data Import Handler mapping
- Building the search index
- Registering the new field in search tables
- Customizing the UserData property name mapping and search configuration
- Modifying the Aurora starter store to display the custom data