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
- Define the search metadata for each attribute and table
you want to make searchable. This requires the following:
- Each searchable table must have a corresponding class
that is a subclass of the TableInfo class. This subclass must specify
the table name.
- 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.
- Create a subclass of the RuleQuery class, and define static
references for each new search constraint.
- 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.
- 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:
- Copy the following file to a temporary location:
- WC_eardir/xml/config/search.xml
- WCDE_installdirworkspace_dir/wc/xml/config/search.xml
This file should never be directly modified. For more information,
refer to XML
configuration directory.
- Open the temporary copy of the file in a text editor.
- Make your changes.
- Save your changes.
- 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.