You are here

public function SearchQuery::searchExpression in Drupal 7

Sets up the search query expression.

Parameters

$query: A search query string, which can contain options.

$module: The search module. This maps to {search_index}.type in the database.

Return value

The SearchQuery object.

File

modules/search/search.extender.inc, line 148
Search query extender and helper functions.

Class

SearchQuery
Do a query on the full-text search index for a word or words.

Code

public function searchExpression($expression, $module) {
  $this->searchExpression = $expression;
  $this->type = $module;

  // Add a search_* tag. This needs to be added before any preExecute methods
  // for decorated queries are called, as $this->prepared will be set to TRUE
  // and tags added in the execute method will never get used. For example,
  // if $query is extended by 'SearchQuery' then 'PagerDefault', the
  // search-specific tag will be added too late (when preExecute() has
  // already been called from the PagerDefault extender), and as a
  // consequence will not be available to hook_query_alter() implementations,
  // nor will the correct hook_query_TAG_alter() implementations get invoked.
  // See node_search_execute().
  $this
    ->addTag('search_' . $module);
  return $this;
}