The CatalogSearchFormHandler
class allows you to specify multiple search types in a single request. For example, you can search on both keywords and text, or you can combine advanced searching with hierarchical searching to find only items in a particular category. In fact, you can use any combination of search types.
Search types are combined according to the following rules:
Text and keyword searches are combined using the OR operator, so that a match on either set of criteria selects an item for inclusion in the search results.
Hierarchical and advanced searches are combined using the AND operator, limiting the scope of the search to items that satisfy the hierarchical or advanced search requirements in addition to any specified text or keyword search criteria.
The query is of the form:
(KeywordConditions OR TextConditions) AND HierarchicalConditions AND
AdvancedSearchConditions
For example, suppose you have a catalog of videos and DVDs, and you configure a search form handler to allow all four types of searches. The customer enters the following search criteria:
keywords=comedy
textSearchPropertyNames=description
searchInput=Steve Martin
hierarchicalCategoryId=BudgetMovies
propertyValues.format=DVD
The search will locate all comedies plus all movies whose description mentions Steve Martin, but will return only the subset of those movies that are found in the BudgetMovies
category and are available on DVD.