Sun Directory Server Enterprise Edition 7.0 Developer's Guide

Enabling Sorting According to a Matching Rule

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.

How Directory Server Performs Sorting According to 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:

  1. 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.

  2. 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.

  3. 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.

  4. Directory Server sorts results based on the keys the indexer function set in SLAPI_PLUGIN_MR_KEYS.

  5. 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.