OVerview#

Search Using the Server-Side Sort Control

The Server Side Sort Control (SSS) allows the client to request that the server sort the search results before sending them to the client. This is convenient when the server has indexes that can satisfy the sort order requested by the client faster than the client can.

You can sort the number of entries returned by using the --sortOrder option. If you do not specify + (a plus sign) for ascending or - (a minus sign) for descending, then the default option is to sort in ascending order.

Use the ldapsearch command to search all entries and to display the results in ascending order.

Use the --sortOrder option sorted on the attributes sn and givenName.

Here is a LDAP Query Example Using the Server Side Sort Control on a particular LDAP Server using the --sortOrder option sorted on the attributes sn and givenName:

$ ldapsearch -h localhost -p 1389 -D "cn=Directory Manager" -w password --s sub -b dc=example,dc=com --sortOrder sn,givenName "(objectclass)"

dn: uid=dakers,ou=People,dc=example,dc=com
objectClass: person
objectClass: organizationalPerson
...<search results>...

Here is a LDAP Query Example Using the Server Side Sort Control on a particular LDAP Server the --sortOrder option sorted on the attribute sn in descending order:

$ ldapsearch -h localhost -p 1389 -D "cn=Directory Manager" -w password -s sub -b dc=example,dc=com --sortOrder -sn "(objectclass)"

dn: uid=pworrell,ou=People,dc=example,dc=com
objectClass: person
objectClass: organizationalPerson
...<search results>...

More Information#

There might be more information for this subject on one of the following:

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-7) was last changed on 06-Nov-2015 05:37 by jim