Example: Indexing new currency offer prices
In this example, WebSphere Commerce Search is customized to index new currency offer
prices.
Before you begin
Procedure
-
Configure the search preprocessor:
-
Preprocess the search index data.
-
Configure the Data Import Handler mapping.
-
Enable the price range facet:
- Insert a new attribute into the SRCHATTR table:
Where:INSERT INTO srchattr (SRCHATTR_ID, INDEXSCOPE, INDEXTYPE, IDENTIFIER) values (primary_key, '0', 'CatalogEntry', '_cat.OfferPrice_XXX');
- primary_key is an unused key in the SRCHATTR_ID column.
- XXX is the new currency code, such as SEK.
INSERT INTO srchattr (SRCHATTR_ID, INDEXSCOPE, INDEXTYPE, IDENTIFIER) VALUES (10000, '0', 'CatalogEntry', '_cat.OfferPrice_SEK');
- Insert a new record into the SRCHATTRPROP table for price ranges
Where:INSERT INTO srchattrprop (SRCHATTR_ID, PROPERTYNAME, PROPERTYVALUE) VALUES (srchattr_id, 'facet', 'price_XXX:{* Number1} Number1;{Number1 Number2} Number2;{Number2 Number3} Number3;{Number3 Number4} Number4;{Number4 Number5} Number5;{Number5 *}');
- srchattr_id is the primary key that is used in the previous query.
- XXX is the new currency code, such as SEK.
- Number1 through Number5 are the values for price ranges in the facet
INSERT INTO srchattrprop (SRCHATTR_ID, PROPERTYNAME, PROPERTYVALUE) VALUES (10000, 'facet', 'price_SEK:{* 100} 100;{100 200} 200;{200 300} 300;{300 400} 400;{400 500} 500;{500 *}');
- Insert a new record into the FACET table.
For example:
INSERT INTO facet (FACET_ID, SRCHATTR_ID, SELECTION, SORT_ORDER, KEYWORD_SEARCH, ZERO_DISPLAY, STOREENT_ID, MAX_DISPLAY, SEQUENCE ) values (10000,10000,0,0,1,0,0,20,0.0);
- Insert a new record into the FACETDESC table.
For example:
insert into facetdesc (FACET_ID, LANGUAGE_ID, NAME, DESCRIPTION) values (10000,-1,'Price-SEK','price facet in SEK');
- Insert a new attribute into the SRCHATTR table:
- Restart the WebSphere Commerce Search server.
- Run the di-buildindex utility.
-
Verify that your new currency data is indexed by entering the following URL in your web
browser:
- http://localhost/solr/MC_10101_CatalogEntry_en_US/select?q=*:*
- http://yoursolrserverhost:3737/solr/MC_10101_CatalogEntry_en_US/select?q=*:*
A sample snippet should display that contains the following snippet:
Where<float name="price_XXX">offer_price</float>
XXX
is the new currency code, such as SEK, andoffer_price
is the price for a product in the new currency, such as 100.0.