Customizing catalog search

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

About this task

To customize the catalog search framework search engine:

Procedure

  1. Define the search metadata for each attribute and table you want 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_eardir/xml/config/search.xml
      • WebSphere Commerce Developer WCDE_installdirworkspace_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 your changes.
    4. Save your changes.
    5. Update WebSphere Commerce with the updated file. For more information, see the Updating enterprise application files topic. Ensure that you follow the instructions for updating a single file.

      You will need the following information:

      Enterprise application name
      WC_enterprise_application
      Relative path to file
      xml/config/search.xml

Results

Note: 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.