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