Tutorials > WebSphere Commerce search


Next >


Tutorial: Indexing ratings data in WebSphere Commerce search from an external source

In this tutorial, newly added search fields are used in the Management Center. That is, a Ranking field is added and used as a sorting field when creating search rules. Search rules provide ways to manipulate search result ordering and ranking in starter stores, where the new Ranking field is used as a sort criteria.

Typically, in cases where a predefined field is in the search schema with no data or tables for it in the WebSphere Commerce relational database, the preprocessor provides support. That is, when to index the data for those fields from external sources. The indexing process is broken down into two separate steps. The first is the flattening of the relational tables and the second is the actual indexing of the flattened data using the Data Import Handler (DIH). This two step process also provides a customization midpoint to bring external data into the index. The approach is, using the preprocess configuration extensions, create temporary tables that become part of the other tables that are used during the full index build. In the preprocessor configuration extension, you provide Java extension classes that are called as a final step of the preprocessing. This not only creates the temporary tables needed for the data, but also enables you to insert data into the the temporary tables. That is, the preprocessing creates the new temporary tables and the Java extension class parses the external data and inserts the required data into the temporary tables.

Once the temporary tables are populated with the external data, you can add them as part of the index building step. This is achieved by configuring the DIH configuration file to modify the select queries to include the new temporary tables and provide mapping between the temporary table column and the index field. This ensures that the next time the index build is run, it associates the new table data with the existing data and sends them to the index.

After the external data is indexed, by modifying the Management Center object definition files, it enables you to use the newly added column. In this tutorial, the newly added field can be used as a new sorting filter.

To show the search results in the Madisons starter store, the mediator configuration file is modified accordingly. When a search query is submitted, it is forwarded to the index and then all the results are returned back as XML. In WebSphere Commerce search, the mediation layer handles how the results are manipulated and populated into the logical nouns for other services such as the user interface to consume. This is done in the mediator configuration file. The logical name mapping to the noun fields is provided so that the WebSphere Commerce runtime can automatically populate the fields. Since ranking fields are new and they do not have a placeholder in the CatalogNavigationViewType noun, they are mapped into the user data field. Once the mapping is complete, they are simply extracted and displayed in the Madisons starter store.

The following diagram illustrates this process:

All extensions in this tutorial use an X_ prefix as a recommended customization naming convention.


Learning objectives

After completing this tutorial, you should be able to:


Time required

Expect this tutorial to take about 2 hours to complete.


Skill level

Advanced


Audience

This tutorial is intended for WebSphere Commerce developers responsible for creating and customizing WebSphere Commerce BOD services.


System requirements

Before beginning this tutorial ensure that you have:


Prerequisites

Ensure you have completed the following prerequisites:

Workspaces are not supported when completing this tutorial.

To complete this tutorial you should be familiar with the following terms and concepts:


Lessons in this tutorial


Related concepts

WebSphere Commerce search

Related reference

WebSphere Commerce search tutorials

Next >


+

Search Tips   |   Advanced Search