When a customer navigates a site, facets are not returned until a search query is issued. If you want facets to appear without a customer explicitly entering a search query, you can silently issue a textless query when the customer selects a category. This is sometimes referred to as category navigation.

For example, suppose a site has top-level categories of Shoes, Hats, and Gloves. When the customer clicks the link for the Hats category, the products or SKUs in that category are displayed along with the appropriate facets for the category. The products or SKUs can be obtained using standard Oracle ATG Web Commerce catalog navigation or through a search query, but a search query must be issued to return the facets. The query is submitted when the page for the category is loaded, and specifies the category to return results and facets for.

To specify the category, you set the startCategory property of the QueryRequest component. For example:

<dsp:setvalue bean="QueryFormHandler.searchRequest.startCategory"
   param="/Meta/ancestorCategories.catalogSpecificId/${categoryId}"/>
<dsp:setvalue bean="QueryFormHandler.search" value="submit"/>

This code assumes the category ID has been passed to the page through a query parameter on the selected link. For example, the anchor tag for the link to the Hats category might look like this:

<a title="Hats" href="/store/browse/category.jsp?categoryId=cat50001">

Note that setting startCategory this way requires that the ancestorCategories.catalogSpecificId property be included in the index and stored as a document set. This property is an array of the catalog-specific category IDs of a product’s ancestor categories, which are determined by the /atg/commerce/search/CustomCatalogCategoriesPropertyAccessor component. The definition file of the /atg/commerce/search/ProductCatalogOutputConfig component includes this property by default:

<item is-multi="true" property-name="ancestorCategories">
  <meta-properties>
    <property store-as-docset="true" name="catalogSpecificId" type="string"
       property-accessor=\
         "/atg/commerce/search/CustomCatalogCategoriesPropertyAccessor"
         output-name="ancestorCategories.catalogSpecificId"
         is-non-repository-property="true" filter="unique"/>
  </meta-properties>
</item>