function hook_search_api_query_alter in Search API 7
Same name and namespace in other branches
- 8 search_api.api.php \hook_search_api_query_alter()
Lets modules alter a search query before executing it.
Parameters
SearchApiQueryInterface $query: The search query being executed.
2 functions implement hook_search_api_query_alter()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- search_api_facetapi_search_api_query_alter in contrib/
search_api_facetapi/ search_api_facetapi.module - Implements hook_search_api_query_alter().
- search_api_search_api_query_alter in ./
search_api.module - Implements hook_search_api_query_alter().
1 invocation of hook_search_api_query_alter()
- SearchApiQuery::preExecute in includes/
query.inc - Prepares the query object for the search.
File
- ./
search_api.api.php, line 340 - Hooks provided by the Search API module.
Code
function hook_search_api_query_alter(SearchApiQueryInterface $query) {
// Exclude entities with ID 0. (Assume the ID field is always indexed.)
if ($query
->getIndex()
->getEntityType()) {
$info = entity_get_info($query
->getIndex()
->getEntityType());
$query
->condition($info['entity keys']['id'], 0, '<>');
}
}