You are here

final class ProcessingResultsEvent in Search API 8

Wraps a processing results event.

Hierarchy

Expanded class hierarchy of ProcessingResultsEvent

2 files declare their use of ProcessingResultsEvent
EventListener.php in tests/search_api_test_events/src/EventListener.php
Query.php in src/Query/Query.php

File

src/Event/ProcessingResultsEvent.php, line 11

Namespace

Drupal\search_api\Event
View source
final class ProcessingResultsEvent extends Event {

  /**
   * The search results.
   *
   * @var \Drupal\search_api\Query\ResultSetInterface
   */
  protected $results;

  /**
   * Constructs a new class instance.
   *
   * @param \Drupal\search_api\Query\ResultSetInterface $results
   *   The search results.
   */
  public function __construct(ResultSetInterface $results) {
    $this->results = $results;
  }

  /**
   * Retrieves the search results.
   *
   * @return \Drupal\search_api\Query\ResultSetInterface
   *   The search results to alter.
   */
  public function getResults() {
    return $this->results;
  }

  /**
   * Sets the search results.
   *
   * Usually, just making changes to the existing results object is sufficient,
   * and that is the preferred way of changing results. However, in certain
   * situations it can make sense to replace the results object with a
   * completely new object instead, in which case this method can be used.
   *
   * It should not be used unless really necessary, though, to avoid unintended
   * side effects (in case of modules that assume the results object will stay
   * unchanged).
   *
   * @param \Drupal\search_api\Query\ResultSetInterface $results
   *   The new search results.
   */
  public function setResults(ResultSetInterface $results) {
    $this->results = $results;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ProcessingResultsEvent::$results protected property The search results.
ProcessingResultsEvent::getResults public function Retrieves the search results.
ProcessingResultsEvent::setResults public function Sets the search results.
ProcessingResultsEvent::__construct public function Constructs a new class instance.