Develop > Controller layer > Application developer > Catalog subsystem > Catalog search methods


Customize catalog search

Due to varying site requirements, we will probably find it necessary to use database table columns in the search that do not exist in the catalog search framework provided upon installation. The catalog search framework search engine is a class.

To customize the catalog search framework search engine:


Procedure

  1. Define the search metadata for each attribute and table to make searchable. This requires the following:

    1. Each searchable table must have a corresponding class that is a subclass of the TableInfo class. This subclass must specify the table name.

    2. Each searchable constraint must have a corresponding class that is a subclass of the AttributeInfo class. This subclass must specify the table info, the column name, and the SQL datatype of the column.

  2. Create a subclass of the RuleQuery class, and define static references for each new search constraint.

  3. Create the findAttributeInfoName() method. Modify the method to call the super.findAttributeInfoName() method. Add factory class creation logic to this method to create an AttributeInfo metadata class for each searchable constraint as needed.

  4. Modify the search.xml file adding predefined table join relationships for any new searchable tables. Join relationships are required for all table combinations.

    To modify the search.xml file:

    1. Copy the following file to a temporary location:

      • WC_EAR/xml/config/search.xml

      • workspace_dir/wc/xml/config/search.xml

      This file should never be directly modified. For more information, refer to XML configuration directory.

    2. Open the temporary copy of the file in a text editor.

    3. Make the changes.

    4. Save the changes.

    5. Update WebSphere Commerce with the updated file. See the Update applications topic in the WebSphere Application Server Information Center for instructions. Ensure that you follow the instructions for updating a single file.

      You will need the following information:

      Enterprise application name

      WC_enterpise_application

      Relative path to file

      xml/config/search.xml


Results

During development, it is useful to enable tracing on the component WC_SEARCH. By looking at the trace log, you can see the generated SQL.


Related concepts

Catalog search methods

Simple catalog search

Advanced catalog search


Related tasks

Add catalog search to the site

Related reference

Catalog search limitations


+

Search Tips   |   Advanced Search