Show Table of Contents
11.5. Handling Sorting by Matching Rules
If you have set up indexing by a matching rule, you can also sort search results by that matching rule. The server can use the keys in the index to sort the search results.
When processing a request to sort by a matching rule, the server does the following:
- In a new Slapi_PBlock parameter block, the server sets the following parameters:
- Sets the OID in the
SLAPI_PLUGIN_MR_OIDparameter. - Sets the attribute type (of the value being added, modified, or removed) in the
SLAPI_PLUGIN_MR_TYPEparameter. - Sets the
SLAPI_PLUGIN_MR_USAGEparameter toSLAPI_PLUGIN_MR_USAGE_SORT. (This indicates that the created indexer object will be used for sorting, not indexing.)
- The server then calls the indexer factory function (specified in the
SLAPI_PLUGIN_MR_INDEXER_CREATE_FNparameter) for the plug-in. - The server generates the index keys for the values to be sorted:
- The server sets the
SLAPI_PLUGIN_MR_VALUESparameter to the array of berval structures containing the values to be sorted. - The server calls the indexer function (specified by the
SLAPI_PLUGIN_MR_INDEXER_FNparameter). - The server then gets the value of the
SLAPI_PLUGIN_MR_KEYSparameter, which is an array of berval structures containing the keys corresponding to the values.
- The server compares the keys to sort the results.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.