13.5. Changing the Index Sort Order

By default, indexes are sorted alphabetically, in descending ASCII order. This is true for every attribute, even attributes which may have numeric attribute values like Integer or TelephoneNumber. It is possible to change the sort method by changing the matching rule set for the attribute.

13.5.1. Changing the Sort Order in the Console

  1. Select the Configuration tab.
  2. Expand the Data node, expand the suffix of the database to index, and select the database.
  3. Select the Indexes tab in the right pane.
  4. Select the index, and, in the Matching Rules field, enter the new sort order to use. For example, to sort by numbers, rather than alphabetically, enter integerOrderingMatch.
  5. Click Save.

13.5.2. Changing the Sort Order in the Command Line

To change the sort order using the command line, change the nsMatchingRule for the attribute index. For example:
# ldapmodify -D "cn=Directory Manager" -W -x

dn: cn=sn,cn=index,cn=Example1,cn=ldbm database,cn=plugins,cn=config