Clients can request that Directory Server sort results from an extensible match search. This section explains how to enable sorting based on a matching rule.
Directory Server performs sorting as a variation of indexing, using the keys generated by an indexer function to sort results. The process is as follows:
Directory Server creates a parameter block as for indexing, setting SLAPI_PLUGIN_MR_USAGE to SLAPI_PLUGIN_MR_USAGE_SORT, before passing the parameter block to the indexer factory function.
The indexer factory function should set parameters in the parameter block as for indexing.
If the sort function is different from the normal indexer function, ensure that the function checks the value of SLAPI_PLUGIN_MR_USAGE, and then sets SLAPI_MR_INDEXER_FN accordingly.
Directory Server sets SLAPI_PLUGIN_MR_VALUES in the parameter block as a pointer to the values to be sorted. Directory Server then passes the parameter block the indexer function.
Directory Server sorts results based on the keys the indexer function set in SLAPI_PLUGIN_MR_KEYS.
Directory Server frees memory that was allocated for the operation.
Refer to Indexing Entries According to a Matching Rule for details on how matching rule plug-ins can allow Directory Server to perform indexing based on a matching rule.