By default, for a search to be indexed, the search string must be at least three characters long, without counting any wildcard characters. For example, the string
abc would be an indexed search while
ab* would not be. Indexed searches are significantly faster than unindexed searches, so changing the minimum length of the search key is helpful to increase the number of indexed searches.
To improve search performance, particularly for sites with many wildcard searches, the search string length for indexed searches can be changed. Directory Server has three attributes which allow you to change the minimum number of characters required for an indexed search:
nsSubStrBegin attribute sets the required number of characters for an indexed search for the beginning of a search string, before the wildcard.
nsSubStrMiddle attribute sets the required number of characters for an indexed search where a wildcard is used in the middle of a search string. For example:
nsSubStrEnd attribute sets the required number of characters for an indexed search for the end of a search string, after the wildcard. For example:
The default substring search length for the string triplet (before, middle, and end) is 3, 3, and 3, meaning every search requires a minimum of three characters, in every wildcard position.
For any attribute index to have alternate string lengths, add the
extensibleObject object class to the entry and then set the substring search lengths.
Set the new key length for the specific attribute index. This requires adding the
extensibleObject object class and then adding the
nsSubStrMiddle attributes as appropriate. For example:
# ldapmodify -D "cn=directory manager" -W -p 389 -h server.example.com -x
dn: attribute_name,cn=index,cn=database_name,cn=ldbm database,cn=plugins,cn=config
Stop the server.
service dirsrv stop
Recreate the attribute index. If even one of the substring search width options is changed, then the entire index must be recreated.
db2index -t attribute_name
Start the server again.
service dirsrv start