ExpressionEngine® User Guide

Legacy Documentation

You are using the documentation for version 4.3.8. Go here for the latest version.

Search Module Extension Hooks

channel_search_modify_search_query

channel_search_modify_search_query($sql, $hash)

Modify the query stored by the Search Module. When a new search is performed, the Search Module creates the query for searching the database and caches that query in the database for later retrievals.

How it’s called:

$modified_sql = ee()->extensions->call('channel_search_modify_search_query', $sql, $this->hash);
...
if (ee()->extensions->end_script === TRUE) return $sql;
Parameters:
  • $sql (string) – Unmodified search query
  • $hash (string) – Unique ID identifying this query in the database
Returns:

SQL query

Return type:

String

New in version 2.8.

channel_search_modify_result_query

channel_search_modify_result_query($sql, $hash)

Modify the query retrieved by the Search Module. When search results are displayed, a cached query is retrieved from the database to perform the search.

How it’s called:

$modified_sql = ee()->extensions->call('channel_search_modify_result_query', $sql, $search_id);
Parameters:
  • $sql (string) – Unmodified search query
  • $search_id (string) – Unique ID identifying this query in the database
Returns:

SQL query

Return type:

String

New in version 2.8.