Language and Page Formatting Options
13.6. Changing the Width for Indexed Substring Searches
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
abcwould 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:
nsSubStrBeginattribute sets the required number of characters for an indexed search for the beginning of a search string, before the wildcard.
nsSubStrMiddleattribute sets the required number of characters for an indexed search where a wildcard is used in the middle of a search string. For example:
nsSubStrEndattribute 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
extensibleObjectobject 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
extensibleObjectobject class and then adding the
nsSubStrMiddleattributes 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 changetype: modify add: objectclass objectclass: extensibleObject - add: nsSubStrBegin nsSubStrBegin: 2 - add: nsSubStrMiddle nsSubStrMiddle: 2 - add: nsSubStrEnd nsSubStrEnd: 2