You are here

function search_config_db_rewrite_sql in Search configuration 6

Rewrite the search query to exclude selected node types.

I feel dirty; This is such a hack. sensible into core.

See also

http://www.lullabot.com/articles/hiding-content-drupals-search-system

http://drupal.org/node/111744 if you want to help get something

File

./search_config.module, line 344
Used to configure the advanced search form and other search behaviour.

Code

function search_config_db_rewrite_sql($query, $primary_table, $primary_field, $args) {
  if ($query == '' && $primary_table == 'n' && ($primary_field = 'nid' && empty($args))) {
    $excluded_types = array_filter(variable_get('search_config_disable_index_type', array()));
    if (!empty($excluded_types)) {
      $where = " n.type NOT IN ('" . join("','", $excluded_types) . "') ";
      return array(
        'where' => $where,
      );
    }
  }
}