Advanced catalog search
The advanced version of the catalog search feature provides a more comprehensive search facility to your customers through the use of flexible search terms that limit search results.Customers can use multiple input fields to create more complex search terms and control how these terms are processed using operator types (for example, <,>,=, like).
Search expressions can be defined using Boolean constraints to control search parameters. These indicators flag how the search constraint should be used in the expression. Boolean expression differs from a simple word search with three options:
- search any word for a broader search (default)
- search all words for a narrower search
- search exact phrase
Refer to the Search method comparison table to see the search attributes that offer Boolean support. See the section on Boolean Expressions for the algorithm.
Additionally, your customers can search based on rich attributes, such as color or size. From the customer's perspective, specifying search expressions for rich attributes is no different from other attributes.
Search on a vertical schema is somewhat unique to the WebSphere Commerce schema, where attributes can be defined as values rather than columns in a table. This type of attributes are commonly referred to as rich attributes. Performing a search using these rich attributes requires creating more complex queries in the underlying search engine. These queries can have significant performance implications. Boolean support is not available for search terms using this type of attributes. Supported operator types are the same as those available for string or numeric searches. Unless specified, the default operator for this type is "equal".
Rich attributes are not known until the database has been populated with data after WebSphere Commerce Server has completed installation. When the database is populated, customize the catalog search bean to expose these attributes as valid search terms. While both advanced search techniques are supported, Boolean expressions cannot be used to search rich attributes.
Due to the wide variety of search options and the ability to specify multiple input fields, the advanced search interface is usually presented to customers as a separate page in the store. Often, the link to the advanced search page is located on the simple search results page, which invites customers to refine the results that they received, or to expand their search in cases where no results were returned.
For an example of one implementation method for the advanced catalog search, refer to the AdvancedCatalogSearchForm.jsp file in the Consumer Direct and B2B Direct starter stores.
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
Catalog search featuresRelated tasks
Add catalog search to your site