This hook allows a plugin to modify attributes before an object is indexed.

This should only be used in very special cases, and generally only by plugins providing features to other plugins.

Use reindexText() to reindex the text on an object if your plugin adds some text to an object for indexing, and it’s changed without the object having been updated.

The StoreObject passed to the hook is read only. mutableCopy() should be used to make a copy, which is then modified. To work well with other plugins, start with an existing replacement object if one already exists, following the example below.

This hook will be called several times for each object update.

Call reindex() when the results of this hook will change to update the object store.


This example hook adds additional text to the notes field for File objects.

P.hook('hPreIndexObject', function(response, object) {
    if(object.isKindOf(T.File)) {
        var r = response.replacementObject || object.mutableCopy();
        r.append("notes ...", A_NOTES);
        response.replacementObject = r;


Name Type Description
object StoreObject The object which is being updated


Return information by changing these properties of the response object.

Name Type Description
replacementObject StoreObject An object which will be indexed in place of the given object, or null for no effect

JavaScript template

P.hook('hPreIndexObject', function(response, object) {
    // Respond to hook, for example
    // response.replacementObject = ...