You can configure the sort options for properties and dimensions returned by queries.

You can specify default sorting for records in results lists through the sortOption property of the resultsListDefaultConfig bean in assembler-context.xml.

The sortOption property specifies a default sorting order for records based on the values of a property common to all the records. The sort order can be ascending or descending. The default sorting order applies only to records to which no other type of sorting applies.

For example, the following sortOption property specifies that records with a property named product.analytics.total_sales be sorted in ascending order based on the value of this property in each record:

<property name="sortOption"> 
  <bean class="com.endeca.infront.navigation.model.SortOption"> 
    <property	name="label" value="Most Sales" /> 
    <property name="sorts">
      <list> 
       <bean class="com.endeca.infront.navigation.model.SortSpec">
         <property name="key" value="product.analytics.total_sales" />
         <property name="descending" value="false" /> 
       </bean> 
     </list>
    </property> 
  </bean> 
</property>

where:

Enabling runtime selection of sort options

You can also configure sort options for shoppers to select through your web pages at run time.

For example, suppose that you want shoppers to be able to sort records on their relevance, or on the value of their product.price properties in either ascending or descending order.

To sort records in these way, your web page can provide a drop down list such as the following:

To enable your application to provide such choices through a drop down list or other feature of the user interface, you configure resultsListSortOptions in assembler-context.xml as follows:

<util:list id="resultsListSortOptions" scope="prototype"> 
   <bean class="com.endeca.infront.cartridge.model.SortOptionConfig">            
     <property name="label" value="Relevance"/>            
     <property name="value" value=""/>        
   </bean>
<bean class="com.endeca.infront.cartridge.model.SortOptionConfig"> 
    <property name="label" value="Price (Ascending)"/> 
    <property name="value" value="product.price|0"/> 
  </bean> 
  <bean class="com.endeca.infront.cartridge.model.SortOptionConfig"> 
    <property name="label" value="Price (Descending)"/> 
    <property name="value" value="product.price|1"/> 
  </bean> 
</util:list>

where:


Copyright © Legal Notices