You are here

public function SearchQuery::searchExpression in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/search/src/SearchQuery.php \Drupal\search\SearchQuery::searchExpression()

Sets the search query expression.

Parameters

string $expression: A search string, which can contain keywords and options.

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

Return value

$this

File

core/modules/search/src/SearchQuery.php, line 205
Contains \Drupal\search\SearchQuery.

Class

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

Namespace

Drupal\search

Code

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

  // Add query tag.
  $this
    ->addTag('search_' . $type);

  // Initialize conditions and status.
  $this->conditions = db_and();
  $this->status = 0;
  return $this;
}