Directory Server relies on indexes of directory data to perform fast lookups. The indexes are based on the attribute values in LDAP entries. Attribute values are linked to the entries on which they are found. For example, an index of surname attributes might contain a list of entries whose SN attribute value matches Jensen.
Directory Server lets you set up the following types of indexes.
- presence
- Match entries for which the attribute is set. Useful when you want all entries that have a given attribute like sn=*.
- equality
- Allow you to match exact values like sn=Jensen or sn=Smith.
- substring
- Let you match values like sn=Jens*, and sn=*ith.
- approximate
- Allow “sounds like” matching (for US English).
- browsing
- Also known as virtual list view indexes. Let you retrieve slices of entries. Particularly useful for GUI apps.
- international
- Permit matching when the collation order for sorting attribute values is different from US English.
Presence, equality, and substring indexes are perhaps the most frequently used types. Many indexes are configured by default when you create a new suffix.
$ dsconf list-indexes dc=example,dc=com owner dc=example,dc=com member dc=example,dc=com nsds5ReplConflict dc=example,dc=com nsuniqueid dc=example,dc=com aci dc=example,dc=com entrydn dc=example,dc=com nsCalXItemId dc=example,dc=com objectclass dc=example,dc=com nscpEntryDN dc=example,dc=com nswcalCALID dc=example,dc=com givenName dc=example,dc=com mail dc=example,dc=com uid dc=example,dc=com telephoneNumber dc=example,dc=com cn dc=example,dc=com pwdaccountlockedtime dc=example,dc=com nsRoleDN dc=example,dc=com uniquemember dc=example,dc=com pipuid dc=example,dc=com parentid dc=example,dc=com pipstatus dc=example,dc=com sn dc=example,dc=com numsubordinates dc=example,dc=com mailAlternateAddress dc=example,dc=com pwdfailuretime dc=example,dc=com nsLIProfileName dc=example,dc=com seeAlso dc=example,dc=com pwdgraceusetime dc=example,dc=com mailHost
When you add your own, custom attributes, or when you have applications that require quick lookups on an attribute for which there is no default index, you can usually boost search performance by adding an index.
The dsconf command makes it easy to add presence, equality, and substring indexes for your attributes. To add an index, first you create the index for your suffix. Then you tell Directory Server to reindex for the attribute.
$ dsconf create-index dc=example,dc=com myCustomAttr $ dsconf reindex -t myCustomAttr dc=example,dc=com ## example: Indexing attribute: myCustomAttr ## example: Finished indexing. Task completed (slapd exit code: 0). $ dsconf get-index-prop dc=example,dc=com myCustomAttr eq-enabled : on pres-enabled : on sub-enabled : off approx-enabled : off matching-rule : system : no all-ids-threshold-eq : inherited (4000) all-ids-threshold-pres : inherited (4000) all-ids-threshold-sub : N/A all-ids-threshold : inherited (4000) desc :
As you see from the property listing, the index for myCustomAttr includes by default equality and presence indexes, but not other types. You can choose explicitly, however, to set up other types of indexes for your attributes. You set the index properties before reindexing.
$ dsconf create-index dc=example,dc=com myAttr $ dsconf set-index-prop dc=example,dc=com myAttr approx-enabled:on $ dsconf reindex -t myAttr dc=example,dc=com ## example: Indexing attribute: myAttr ## example: Finished indexing. Task completed (slapd exit code: 0). $ dsconf get-index-prop dc=example,dc=com myAttr eq-enabled : on pres-enabled : on sub-enabled : off approx-enabled : on matching-rule : system : no all-ids-threshold-eq : inherited (4000) all-ids-threshold-pres : inherited (4000) all-ids-threshold-sub : N/A all-ids-threshold : inherited (4000) desc :
For more instructions on configuring indexing using the command line, see the Administration Guide. For background information on indexing, see the Reference.
