You are here

public function Query::keys in Search API 8

Sets the keys to search for.

If this method is not called on the query before execution, this will be a filters-only query.

Parameters

string|array|null $keys: A string with the search keys, in one of the formats specified by getKeys(). A passed string will be parsed according to the set parse mode. Use NULL to not use any search keys.

Return value

$this

Overrides QueryInterface::keys

File

src/Query/Query.php, line 424

Class

Query
Provides a standard implementation for a Search API query.

Namespace

Drupal\search_api\Query

Code

public function keys($keys = NULL) {
  $this->origKeys = $keys;
  if (is_scalar($keys)) {
    $this->keys = $this
      ->getParseMode()
      ->parseInput("{$keys}");
  }
  else {
    $this->keys = $keys;
  }
  return $this;
}