To maintain an index for a custom matching rule supported by your plug-in, the server requires an indexer function. The indexer function is capable of translating attribute values to index keys. Directory Server calls the indexer function to create the index, and subsequently when adding, modifying, or deleting attribute values, because such changes can affect the index.
To read an index for a custom matching rule, Directory Server requires a filter index function. The filter factory function provides a pointer to this function. Refer to Handling Extensible Match Filters and Filter Index Function for details.
Directory Server relies on the indexer factory function in your plug-in to set up an indexing object and provide a pointer to the appropriate indexer function.
The following figure shows how Directory Server performs indexing based on a matching rule.
The following summarizes the process shown in Figure 11–4.
Directory Server creates a parameter block, setting parameters to indicate the matching rule OID and attribute type to match. Directory Server then calls the indexer factory function.
The indexer factory function examines the parameter block and allocates an indexer object if necessary. The function also sets pointers to the indexer and filter index functions. If necessary, the function sets a pointer to a destructor to free the indexer object before returning control to Directory Server.
Directory Server sets the parameter block to indicate attribute values to translate to keys and calls the indexer function.
The indexer function translates values to keys. After the indexer returns, Directory Server uses the keys to update the index.
Directory Server frees the parameter block. If necessary, the server frees the indexer object by using the destructor provided.
Be aware that Directory Server can call indexer factory functions concurrently. Indexer factory functions must therefore be thread safe.
The main filter functions are as follows: