search_query_alter.module in Drupal 8
Same filename and directory in other branches
Test module that alters search queries.
File
core/modules/search/tests/modules/search_query_alter/search_query_alter.moduleView source
<?php
/**
 * @file
 * Test module that alters search queries.
 */
use Drupal\Core\Database\Query\AlterableInterface;
/**
 * Implements hook_query_TAG_alter(): tag search_$type with $type node_search.
 */
function search_query_alter_query_search_node_search_alter(AlterableInterface $query) {
  // For testing purposes, restrict the query to node type 'article' only.
  $query
    ->condition('n.type', 'article');
}Functions
| 
            Name | 
                  Description | 
|---|---|
| search_query_alter_query_search_node_search_alter | Implements hook_query_TAG_alter(): tag search_$type with $type node_search. |