
Chapter 7. Index design and data load 197
<!-- Filter all queries to ensure returned catalog entries have quantity -->
<lst name=”appends”>
<str name=”fq”>xquantity:[1 TO *]</str>
</lst>
<arr name=”last-components”>
<str>wc_spellcheck</str>
</arr>
</requestHandler>
<!-- content removed for clarity -->
</config>
7.3.2 Index maintenance
Automatic re-indexing is an event-driven process in WebSphere Commerce V7.0. When a
message is received to mutate the base schema, ChangeCatalogEntry events are raised and
handled by WebSphere Commerce V7.0. These handlers parse the event and mutate
TI_DELTA_CATENTRY. Then, when a CategoryNavigationView message is received, it raises
a SynchronizeIndexEvent if the table is not empty. Neither case raises a ChangeCatalogEntry
event; therefore the TI_DELTA_CATENTRY table is not mutated and we must use the
following re-indexing strategies.
The maintenance for our customized index introduces two separate index update cases:
The inventory update feed is received and loaded into the WebSphere Commerce V7.0
database. We run a full re-index after each inventory feed load to handle this case.
An inventory update is caused by a storefront order. We set up a scheduled job,
RBInventoryDeltaUpdateIndexCmd, which is a sample exercise, that generates an XML
message for all catalog entries that have INVENTORY.QUANTITY = 0. Then, we
HTTP/POST the message to the WebSphere Commerce V7.0 search server.
Follow these steps:
1. Schedule RBInventoryDeltaIndexCmd to run at a certain frequency, f1, that will generate
an inventory_update_message.xml (see Example 7-9).
Example 7-9 inventory_update_message.xml
<?xml version="1.0" encoding="UTF-8"?>
<update>
<add>
<doc>
<field name="buyable">1</field>
<field name="catalog_id">10001</field>
<field name="catentry_id">10246</field>
<field name="catenttype_id_ntk_cs">ProductBean</field>
<field
name="fullImage">images/catalog/apparel/apparel_160x160/IMG_0054_e.jpg</field>
<field name="member_id">7000000000000000002</field>
<field name="mfName">MapleWear</field>
<field name="mfName_ntk">MapleWear</field>
<field name="mfName_ntk_cs">MapleWear</field>
<field name="name">Bodysuit</field>
<field name="parentCatgroup_id_facet">10001_10031</field>
<!-- handle arrays by flattening and repeating the field name element -->