HP-UX Directory Server 8.1 plug-in reference

Table Of Contents
Table 11-1 Input and output parameters available to an indexer factory function
DescriptionData typeParameter name
Input parameter. Matching rule OID (if any)
specified in the index directive.
char *SLAPI_PLUGIN_MR_OID
Input parameter. Attribute type (if any) specified
in the index directive.
char *SLAPI_PLUGIN_MR_TYPE
Input parameter. Specifies the intended use of
the indexer object. This parameter can have one
of the following values:
SLAPI_PLUGIN_MR_USAGE_INDEX specifies
that the indexer object should be used to index
entries.
SLAPI_PLUGIN_MR_USAGE_SORT specifies
that the indexer object should be used to sort
entries.
You can use this to specify different information
in the indexer object or different indexer
functions, based on whether the plug-in is used
for indexing or sorting. For information on sorting
search results, refer to “Handling sorting by
matching rules”.
unsigned intSLAPI_PLUGIN_MR_USAGE
Input parameter. Pointer to any private data
originally specified in the initialization function.
Refer to “Writing an initialization function”, for
details.
void *SLAPI_PLUGIN_PRIVATE
Output parameter. Official matching rule OID of
the index.
char *SLAPI_PLUGIN_MR_OID
Output parameter. Name of the function called
by the server to generate a list of keys used for
indexing a set of values.
void * (function
pointer)
SLAPI_PLUGIN_MR_INDEX_FN
Output parameter. Name of the function to be
called to free the indexer object.
void * (function
pointer)
SLAPI_PLUGIN_DESTROY_FN
Output parameter. Pointer to the indexer object
created by your factory function.
void *SLAPI_PLUGIN_OBJECT
11.3.5 Writing the indexer function
The indexer function takes a single Slapi_PBlock argument. This function will never be called
for the same indexer object concurrently. (If you plan to manipulate global variables, remember
that the server can call this function concurrently for different indexer objects.)
The indexer function should perform the following tasks:
1. Get the values of the following parameters:
Get the indexer object from the SLAPI_PLUGIN_OBJECT parameter (if the parameter
is set).
Get the array of values that you want indexed from the SLAPI_PLUGIN_MR_VALUES
parameter.
2. Generate index keys for these values, and set the SLAPI_PLUGIN_MR_KEYS parameter to
the array of these keys.
3. Return 0 (or the result code LDAP_SUCCESS) if everything completed successfully.
The server adds or removes the keys and the corresponding values from the appropriate indexes.
92 Writing matching rule plug-ins