You are here

public function QueryHelper::createQuery in Search API 8

Creates a new search query object.

Parameters

\Drupal\search_api\IndexInterface $index: The index on which to search.

array $options: (optional) The options to set for the query. See \Drupal\search_api\Query\QueryInterface::setOption() for a list of options that are recognized by default.

Return value

\Drupal\search_api\Query\QueryInterface A search query object to use.

Overrides QueryHelperInterface::createQuery

File

src/Utility/QueryHelper.php, line 73

Class

QueryHelper
Provides methods for creating search queries and statically caching results.

Namespace

Drupal\search_api\Utility

Code

public function createQuery(IndexInterface $index, array $options = []) {
  $query = Query::create($index, $options);
  $query
    ->setModuleHandler($this->moduleHandler);
  $query
    ->setParseModeManager($this->parseModeManager);
  $query
    ->setQueryHelper($this);
  return $query;
}