ExpressionEngine Docs

Extension Hooks

pro_search_catch_searc

Use this hook to check incoming data after a Pro Search form was submitted, and optionally change it.

Arguments

Return

The (modified) array of data.

$data = ee()->extensions->call('pro_search_catch_search', $data);
if (ee()->extensions->end_script === TRUE) return;

pro_search_channel_entries

Use this hook to use your own channel:entries method to parse the search results tagdata, available in the global TMPL object.

Arguments

NULL

Return

The parsed tagdata as a string or FALSE if you want to fall back to the default method.

if (ee()->extensions->active_hook('pro_search_channel_entries') === TRUE)
{
  $tagdata = ee()->extensions->call('pro_search_channel_entries');
}

pro_search_excerpt

Use this hook to change the excerpt data.

Arguments

Return

A string containing the excerpt data or an array containing the excerpt data and a boolean. If an array is given and the second item is FALSE, Pro Search will use the given excerpt as is, without truncating or highlighting the keywords.

$str = ee()->extensions->call('pro_search_excerpt', $entry_ids, $row, $field_id);

pro_search_get_index_entries

Use this hook to get the entries that need to be indexed. The collection details contain the channel ID and settings, which in turn contain the fields (and weight) to get. The keys in $col['settings'] are the field IDs, including 0 for the title and a format of x:y where x is the category group ID and y is the category field.

Arguments

Return

An array containing the entry rows you queried. Per row, it will expect at least an entry_id. These entries will then be processed and added/updated to the search index.

$entries = ee()->extensions->call('pro_search_get_index_entries', $col, $entry_ids);

pro_search_modify_score

Use this hook to modify the score of the search results.

Arguments

Return

An array containing the entry IDs as keys and new scores as values. If the array is empty, it will trigger No Results.

$results = ee()->extensions->call('pro_search_modify_score', $results);

pro_search_post_replace

Use this hook to perform extra processing after the values of the Find & Replace action is performed, like clearing cache.

Arguments

pro_search_post_search

Use this hook to change any of the search parameters after the search is executed.

Arguments

Return

The (modified) array of parameters.

$params = ee()->extensions->call('pro_search_post_search', $params);
if (ee()->extensions->end_script === TRUE) return ee()->TMPL->tagdata;

pro_search_pre_search

Use this hook to change any of the search parameters before the search is executed.

Arguments

Return

The (modified) array of parameters. Adding a key keywords-query:_table_column_ will add its value to the where-clause of the keyword search. For example: $params['keywords-query:entry_id'] = '1';. It allows for multiple items.

$params = ee()->extensions->call('pro_search_pre_search', $params);
if (ee()->extensions->end_script === TRUE) return ee()->TMPL->tagdata;

pro_search_update_index

Use this hook to change the index data for entries.

Arguments

Return

The (modified) array of data.

$ext_data = ee()->extensions->call('pro_search_update_index', $data, $entry);

if (is_array($ext_data) && ! empty($ext_data))
{
  $data = array_merge($data, $ext_data);
}

pro_search_update_lexicon

Use this hook to change the lexicon data before it is inserted.

Arguments

Return

The (modified) array of data.

$ext_data = ee()->extensions->call('pro_search_update_lexicon', $data, $entry);

if (is_array($ext_data) && ! empty($ext_data))
{
  $data = array_merge($data, $ext_data);
}