SortControl DataObject
SortControl specifies how the returned search results are to be sorted.
The structure of a SortControl data object consists of:
- locale
- indicates the language that is used during the sorting operation.
- sortKeys
- Each sortKey data object contains two properties that are used to do the
sorting:
- property
- contains a list of attributes that are used to do the sorting. The attributes included in the SortControl must be listed in the property list of the SearchControl.
- ascendingOrder
- specifies the sorting order for each attribute If set to true, the search results are sorted in ascending order. If set to false the search results are sorted in descending order. For example, if a virtual member manager caller wants to sort the search results by “sn” in descending order, the caller needs to set the ascendingOrder to false.
XML schema definition
The following is the XML schema
definition for the SortControl DataObject:
<xsd:complexType name="SortControl">
<xsd:complexContent>
<xsd:extension base="Control">
<xsd:sequence>
<xsd:element name="sortKeys" type="SortKeyType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="locale" type="xsd:language" />
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
Sample data objects
The following is a sample SortControl
data object for the search API. The search results are sorted by sn (surname)
with the locale set to English.
<wim:controls xsi:type="wim:SortControl">
<wim:sortKeys>
<wim:propertyName>sn</wim:propertyName>
<wim:ascendingOrder>false</wim:ascendingOrder>
</wim:sortKeys>
<wim:locale>en-US</wim:locale>
</wim:controls>
The
following is a sample SortControl data object for the search API. The search
results are first sorted by sn with the locale set to English. If multiple
results with the same sn exist, the results are then sorted by the givenName
in English.
<wim:controls xsi:type="wim:SortControl">
<wim:sortKeys>
<wim:propertyName>sn</wim:propertyName>
<wim:ascendingOrder>false</wim:ascendingOrder>
</wim:sortKeys>
<sortKeys>
<propertyName>givenName</propertyName>
<ascendingOrder>false</ascendingOrder>
</sortKeys>
<wim:locale>en-US</wim:locale>
</wim:controls>