You are here

interface QueryHelperInterface in Search API 8

Provides an interface for query helper services.

Hierarchy

Expanded class hierarchy of QueryHelperInterface

All classes that implement QueryHelperInterface

3 files declare their use of QueryHelperInterface
Query.php in src/Query/Query.php
SearchApiCachePluginTrait.php in src/Plugin/views/cache/SearchApiCachePluginTrait.php
TestItemsTrait.php in tests/src/Unit/Processor/TestItemsTrait.php

File

src/Utility/QueryHelperInterface.php, line 11

Namespace

Drupal\search_api\Utility
View source
interface QueryHelperInterface {

  /**
   * Creates a new search query object.
   *
   * @param \Drupal\search_api\IndexInterface $index
   *   The index on which to search.
   * @param 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 \Drupal\search_api\Query\QueryInterface
   *   A search query object to use.
   */
  public function createQuery(IndexInterface $index, array $options = []);

  /**
   * Adds a result set to the cache.
   *
   * @param \Drupal\search_api\Query\ResultSetInterface $results
   *   The search results to cache.
   */
  public function addResults(ResultSetInterface $results);

  /**
   * Retrieves the results data for a search ID.
   *
   * @param string $search_id
   *   The search ID of the results to retrieve.
   *
   * @return \Drupal\search_api\Query\ResultSetInterface|null
   *   The results with the given search ID, if present; NULL otherwise.
   */
  public function getResults($search_id);

  /**
   * Retrieves all results data cached in this request.
   *
   * @return \Drupal\search_api\Query\ResultSetInterface[]
   *   The results of all searches cached in this service, keyed by their
   *   search IDs.
   */
  public function getAllResults();

  /**
   * Removes the result set with the given search ID from the cache.
   *
   * @param string $search_id
   *   The search ID.
   */
  public function removeResults($search_id);

}

Members

Namesort descending Modifiers Type Description Overrides
QueryHelperInterface::addResults public function Adds a result set to the cache. 1
QueryHelperInterface::createQuery public function Creates a new search query object. 1
QueryHelperInterface::getAllResults public function Retrieves all results data cached in this request. 1
QueryHelperInterface::getResults public function Retrieves the results data for a search ID. 1
QueryHelperInterface::removeResults public function Removes the result set with the given search ID from the cache. 1