Query-time sort ordering

On a per-query basis, you can specify a key on which to sort the records and a sort direction.

You can add a Sort type to a RecordListConfig configuration that lets you specify a key to sort on and the sort direction. The Sort format is:
<Sort Key="?" Direction="?">
   <GeocodeReferencePoint latitude="?" longitude="?"/>
</Sort>
where:
  • Key is mandatory and specifies the name of a standard or managed attribute based on which sorting is performed.
  • Direction is optional and is either Ascending (for an ascending order) or Descending (for a descending order). Ascending is used as the default if Direction is not specified.
  • GeocodeReferencePoint is optional and is used for geospatial sorting. For details on geospatial sorting, see Geospatial sorting.

Both the attribute name and the sort direction are case sensitive.

The following example shows how to specify a sort order:
<soapenv:Envelope 
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header/>
   <soapenv:Body>
      <Request xmlns="http://www.endeca.com/MDEX/conversation/3/0">
         <Language>en</Language>
         <State>
            <Name>AllRecs</Name>
            <RecordKind>data</RecordKind>
         </State>
         <RecordListConfig Id="RecordList" MaxPages="20">
            <StateName>AllRecs</StateName>
            <RecordsPerPage>10</RecordsPerPage>
            <Page>1</Page>
            <Sort Key="ModelName" Direction="Ascending"/>
         </RecordListConfig>
      </Request>
   </soapenv:Body>
</soapenv:Envelope>

The example specifies an ascending sort order based on the ModelName attribute.

Sorting behavior for records without a sort-key value

If an Endeca record does not include a value for the specified sort key, that record is sorted to the bottom of the list, regardless of the sort order.

For example, the following record set is sorted by the P_Year attribute in an ascending order. Note that Record 4 has no P_Year assignment value.
Record 1 (P_Year 1998)
Record 2 (P_Year 2010)
Record 3 (P_Year 2013)
Record 4 (no P_Year property value)
If the sort order is reversed to P_Year descending, the new result set would appear in the following order:
Record 3 (P_Year 2013)
Record 2 (P_Year 2010)
Record 1 (P_Year 1998)
Record 4 (no P_Year property value)
Thus, Record 4 will always appear last because it has no P_Year attribute assignment.