The SearchFormHandler that comes with Oracle ATG Web Commerce only allows you to navigate through your search results if you searched on one item type. Advanced search only searches products. Simple search searches both products and categories and thus does not use the navigation features.

We configured SearchFormHandler to return only twenty search results at a time for advanced searches and included text that informs the user which results he is viewing and how many there are total. (Simple search lists all results on one page.)

We used the properties enableCountQuery and maxResultsPerPage to enable page navigation and set the number of results to be returned. The advanced search and the search using manufacturer part number are configured to return only twenty results per page. The following code is used to display page navigation URLs in advanced_search.jsp.

<dsp:droplet name="Compare">
  <dsp:param bean="AdvProductSearch.resultSetSize" name="obj1"/>
  <dsp:param bean="AdvProductSearch.maxResultsPerPage" name="obj2"/>
  <dsp:oparam name="greaterthan">
    Now viewing results
    <b><dsp:valueof bean="AdvProductSearch.startCount"/> -
    <dsp:valueof bean="AdvProductSearch.endIndex"/></b>
    out of
    <b><dsp:valueof bean="AdvProductSearch.resultSetSize"/></b>
  </dsp:oparam>
</dsp:droplet>

<dsp:droplet name="Switch">
 <dsp:param bean="AdvProductSearch.resultPageCount" name="value"/>
 <dsp:oparam name="1">
 </dsp:oparam>

 <dsp:oparam name="default">
  <br>Results pages:
  <dsp:droplet name="Switch">
     <dsp:param name="value" bean="AdvProductSearch.currentResultPageNum"/>
     <dsp:oparam name="1">

     </dsp:oparam>
     <dsp:oparam name="default">
       <dsp:droplet name="For">
         <dsp:param name="howMany" bean="AdvProductSearch.resultPageCount"/>
         <dsp:oparam name="output">
           <dsp:droplet name="Switch">
             <dsp:param name="value" bean=
               "AdvProductSearch.currentResultPageNum"/>
             <dsp:getvalueof id="countParam" idtype="Integer" param="count">
               <dsp:oparam name="<%=countParam.toString()%>">
                 <dsp:a href="advanced_search.jsp" bean=
                   "AdvProductSearch.currentResultPageNum"
                   paramvalue="index">&lt;&lt; Previous</dsp:a> &nbsp;
               </dsp:oparam>
             </dsp:getvalueof>
           </dsp:droplet>
         </dsp:oparam>
       </dsp:droplet>
     </dsp:oparam>
   </dsp:droplet>

The currentResultPageNum property of SearchFormHandler determines which set of results to display. We iterate through resultPageCount, displaying a URL for each page, and when the user clicks on any URL, the corresponding number is set to SearchFormHandler.currentResultPageNum and it returns the appropriate set.