Add catalog entry properties to search rule actions or targets
Search rule actions and targets in the Management Center dynamically populate a list of catalog entry indexed properties. We must customize WebSphere Commerce search when we are adding new indexed catalog entry properties to search rule actions or targets.Note: We cannot change the property name in search rules once saved. That is, filters of type property are read-only once saved.
The following screen captures show the default property selector in the Management Center:
Procedure
- Register the new indexed catalog entry property in the SRCHATTR table:
INSERT INTO srchattr (SRCHATTR_ID, INDEXSCOPE, INDEXTYPE, IDENTIFIER, OPTCOUNTER) VALUES (10001, '0', 'CatalogEntry', '_cat.fieldname', 0);Where '_cat.fieldname' is the search index field name to add. This field name must be prefixed with '_cat.' to identify the object as a search attribute. In the following examples, the field name customerRanking is used as the identifier for a sample catalog entry property. The customerRanking property is used as a sample catalog entry property to demonstrate the steps in this topic only; by default, this property does not exist for any catalog entry and there is no logic associated with this sample property.
INSERT INTO srchattr (SRCHATTR_ID, INDEXSCOPE, INDEXTYPE, IDENTIFIER, OPTCOUNTER) VALUES (10001, '0', 'CatalogEntry', '_cat.customerRanking', 0);
- Specify the usage and data type of the property in the SRCHATTRPROP table.
Depending on the catalog entry property data type and usage, different PROPERTYNAME values must be used. The usage results in populating the indexed catalog entry properties in different search rule action or target grids. The type results in populating different matching rules in each of the search rule action or target grids. The following table shows the supported usage and data types for catalog entry properties:
Supported usage and data types for catalog entry properties
Property Data type Usage merchandising-Filter-ExactText Single words or phrases such as Manufacturer Name. Catalog Entry properties with these usage-types are used in the Recommend Catalog Entry, and Add or Replace Search Criteria actions filter grid. merchandising-Filter-AnyText Sentences or multiple words. Such as name and short description. merchandising-Filter-Numeric Decimal numbers or whole numbers. Such as Customer ranking. merchandising-Rank-ExactText Single words or phrases such as Manufacturer Name. Catalog Entry properties with these usage-types are used in the Change Search Result Order ranking grid. merchandising-Rank-AnyText Sentences or multiple words. Such as name and short description. merchandising-Rank-Numeric Decimal numbers or whole numbers. Such as Customer ranking. merchandising-Facet-ExactText Single words or phrases such as Manufacturer Name. Catalog Entry properties with this usage-type are used in the Search Criteria and Result target, search criteria grid. merchandising-Sort-Text All text including single words, phrases, or multiple words such as Manufacturer Name. Catalog Entry properties with this usage are used in the Recommend Catalog Entry, and Add or Replace Search Criteria actions sorting grid. merchandising-Sort-Numeric Decimal numbers or whole numbers. Such as Customer ranking, offer price. For example, to add a sample customerRanking catalog entry property to the Change Search Result Order action ranking grid, the usage is Rank and the data type is Numeric.
INSERT INTO srchattrprop (SRCHATTR_ID, PROPERTYNAME, PROPERTYVALUE, OPTCOUNTER) VALUES (10001, 'merchandising-Rank-Numeric', 'customerRanking', 0);
- Specify the display name of the added indexed catalog entry property in the SRCHATTRDESC table:
INSERT INTO srchattrdesc (SRCHATTR_ID, LANGUAGE_ID, DISPLAYNAME, DESCRIPTION) VALUES (10001, -1, 'displayname', null);Where displayname is the search index field name we want to add. For example,
INSERT INTO srchattrdesc (SRCHATTR_ID, LANGUAGE_ID, DISPLAYNAME, DESCRIPTION) VALUES (10001, -1, 'Customer Ranking', null);
When we are adding a property to the SRCHATTRPROP table, we can also add a language-specific name for the property to be displayed in the Management Center into the SRCHATTRDESC table. This is for the search column that is registered in the SRCHATTR table for which we are defining a new purpose in the SRCHATTRPROP table. If no record is added to the SRCHATTRDESC table, the IDENTIFIER is used from the SRCHATTR table. For example, to add another language display value for the customerRanking indexed catalog entry property:
INSERT INTO srchattrdesc (SRCHATTR_ID, LANGUAGE_ID, DISPLAYNAME, DESCRIPTION, OPTCOUNTER) VALUES (1001, -2, 'translatedText', null, 0);Where translatedText is the translated text in the language we want to show.
- Restart the WebSphere Commerce server.
What to do next
Verify that the correct properties are populated into the search rule actions or targets properties list.