ATG Commerce provides the form handler class atg.commerce.catalog.custom.CatalogSearchFormHandler to search the catalog repository for items such as products and categories. You can use this form handler to construct searches for one or more catalog item types, and you can specify which properties to examine when searching.

For example, you can search for products that contain a specified substring in their names, or for categories that are tagged with a specified keyword, or for both products and categories that have a specified set of property values.

Configuration settings in the form handler’s properties file specify the kinds of elements to search for, the properties of those elements to consider when searching, and additional configuration details for each type of search. Typically, customers specify target values to search for through form fields in a JSP.

The CatalogSearchFormHandler class should provide sufficient search functionality and flexibility for most sites. ATG Commerce includes several CatalogSearchFormHandler components in /atg/commerce/catalog, each one configured for a different set of search options (see Preconfigured Custom Catalog Search Components). You can create additional CatalogSearchFormHandler components and configure them through their properties files or through the Component Editor in the ACC. If your store requires custom search capabilities, you can extend CatalogSearchFormHandler or write another form handler.

CatalogSearchFormHandler can be configured to perform four types of searching:

Keyword Searches
Keyword searches use keyword property names and input search strings to search product and category keywords. The customer enters values that are used for keyword matching. An example of a keyword search is “Show me all products and categories with the keyword shoe.”

Text Searches
Full-text searches use text property names and input search strings to perform text pattern matching on properties. An example of a full-text search is “Show me all products whose longDescription property contains the word wool.” Note that your database must be configured properly to support full-text searches. For more information, see the discussion on databases and database access in the ATG Installation and Configuration Guide.

Hierarchical Searches
Hierarchical searches look in a subset of categories, starting from a given category, and including that category’s child categories, the children of those children, and so on. The given category is indicated by the repository ID in the hierarchicalCategoryId property. To perform hierarchical searches, you must generate the ancestorCategories property for each product and category item, as described in Using the Catalog Maintenance System.

Advanced Searches
Advanced searches provide possible search options for each property specified in the form handler’s advancedSearchPropertyNames property. For example, enumerated types are defined in the repository with a set number of values. Advanced searches retrieve these values from the definition to display in a selection box. The advanced query is built from options selected by the customer to further refine the catalog search. For example, advanced searches allow a customer to search on a description, manufacturer, or price. An example of an advanced search is “Show me all products with the keyword shoe where price range is expensive.”

loading table of contents...