glFusion Wiki

Site Tools


API functions

API functions are called using PLG_callFunctionForOnePlugin(function, $args);

The Searcher plugin also provides functions to handle ItemSaved and ItemDeleted events which should be sufficient. The functions below can be called in special cases.

Functions and the required arguments array are listed below:

plugin_indexDoc_searcher($args = array())

Adds a single document to the index. Also indexes any comments.

At least one of “content”, “title” or “author” must not be empty.


$args = array(
    1 => array(
        'item_id'   => the item ID in its database table (required)
        'type'      => Type of item, e.g. "article" or the plugin name (required)
        'content'   => Full content to index
        'title'     => Item title
        'author'    => Display name of the author, not the user ID
        'date'      => Unix timestamp, defaults to "now" if not provided
        'perms' => array(
            'owner_id'      => Numeric user id of the owner
            'group_id'      => Numeric user id of the gruop
            'perm_owner'    => Owner permission
            'perm_group'    => Group permission
            'perm_members'  => Members permission
            'perm_anon'     => Anonymous user permission
PLG_callFunctionForOnePlugin('plugin_indexDoc_searcher', $args);

The item will not be indexed at all unless at least one of Title, Content or Author is not empty.

If the “perms” element is not provided or is NULL then the permissions allow read access to everyone. Permission fields are added to every record in the index so a guest will only see results that they can actually access.

plugin_RemoveDoc_searcher($type, $item_id)

Removes a single document from the index, along with associated comments. Arguments are a simple array of item type and database ID

$args = array(
    Type of item, e.g. plugin name (required),
    Database ID of the item being removed (required),
PLG_callFunctionForOnePlugin('plugin_removeDoc_searcher', $args);

Removes all itms of a particular type from the index, along with any comments. This should be called as part of a plugin removal.

$args = array(
    'type'      => Type of item, e.g. plugin name (required)
PLG_callFunctionForOnePlugin('plugin_removeAll_searcher', $args);
glfusion/plugins/searcher/api.txt · Last modified: 2017/09/08 06:43 (external edit)

Page Tools