32.10. slapi_mr_indexer_create()

Calls the indexer factory function for the plug-in responsible for a specified matching rule.
Description

This function calls the indexer factory function for the plug-in responsible for handing a specified matching rule. The matching rule is identified by the OID in the SLAPI_PLUGIN_MR_OID parameter.

If no plug-ins are associated with this matching rule, the function calls the indexer factory function for each matching rule plug-in until the SLAPI_PLUGIN_MR_INDEX_FN parameter is set to an indexer function.
Before calling this function, make sure that the parameter block pb contains the information needed by the indexer factory function. You can pass information to the indexer factory function by using the following parameters:
  • SLAPI_PLUGIN_MR_OID should contain the OID of the matching rule that you want used for indexing or sorting.
  • SLAPI_PLUGIN_MR_TYPE should contain the attribute type that you want used for indexing or sorting.
  • SLAPI_PLUGIN_MR_USAGE should specify if the indexer will be used for indexing (SLAPI_PLUGIN_MR_USAGE_INDEX) or for sorting (SLAPI_PLUGIN_MR_USAGE_SORT).
The indexer factory function should set the following parameters:
  • SLAPI_PLUGIN_MR_OID should contain the official OID of the matching rule that you want used for indexing or sorting.
  • SLAPI_PLUGIN_MR_INDEX_FN, if specified, contains an indexer pointer function. The function is responsible for indexing or sorting, based on the matching rule OID or attribute type. The values to index or sort are provided in the slapi_pblock function using the SLAPI_PLUGIN_MR_VALUES parameter. The values are stored in a NULL-terminated berval array.
  • SLAPI_PLUGIN_MR_INDEX_SV_FN, if specified, contains an indexer pointer function. The function is responsible for indexing or sorting, based on the matching rule OID or attribute type. The values to index or sort are provided in the slapi_pblock_get() function using the SLAPI_PLUGIN_MR_VALUES parameter. The values are stored in a NULL-terminated Slapi_Value array.
  • SLAPI_PLUGIN_OBJECT should contain any information that you want passed to the indexer function.
  • SLAPI_PLUGIN_DESTROY_FN should specify the name of the function responsible for freeing any memory allocated by this indexer factory function. For example, memory allocated for a structure that you pass to the indexer function using SLAPI_PLUGIN_OBJECT.
For more information on filter index functions and indexer functions, see Chapter 11, Writing Matching Rule Plug-ins.
Syntax

#include "slapi-plugin.h"
int slapi_mr_indexer_create (Slapi_PBlock *opb);

Parameters

This function takes the following parameter:

pb
Parameter block containing information about the matching rule and attribute type to be used in indexing or sorting.
Returns

This function returns the result code returned by the indexer factory function.