To use facets on your site, you create JSP pages that display the facet selections as hyperlinks. When a customer clicks one of these links, a query is issued to ATG Search. The search results returned are then displayed on the page. These results include only those items whose faceting property value is the selected value or falls within the selected range. The available facet selections are also updated to reflect the selections previously made. This process continues as the customer clicks further links.
To create pages that enable Faceted Search, you use the following classes:
The form handler
atg.search.formhandlers.QueryFormHandler
issues the search queries that include the refinement information, and receives the responses that include the refinements.The
atg.commerce.search.refinement.FacetSearchTools
class processes the refinement data in the search request and response objects.The
atg.repository.search.refinement.FacetTrail
class keeps track of the facet selections made by the customer.
The pages you write should not be associated with specific facets or selections. Instead, they should be written in a generic way, to be able to handle any set of facets defined in ATG Merchandising. Typically you write one primary page that deals with displaying the facets and manipulating the facet trail, and that page is re-rendered each time new results are returned. The remaining sections in this chapter describe how to do this.