You are here

class Result in Search API Solr 8

Same name and namespace in other branches
  1. 8.3 src/Solarium/Autocomplete/Result.php \Drupal\search_api_solr\Solarium\Autocomplete\Result
  2. 8.2 src/Solarium/Autocomplete/Result.php \Drupal\search_api_solr\Solarium\Autocomplete\Result
  3. 4.x src/Solarium/Autocomplete/Result.php \Drupal\search_api_solr\Solarium\Autocomplete\Result

Autocomplete query result.

Hierarchy

  • class \Drupal\search_api_solr\Solarium\Autocomplete\Result extends \Solarium\Core\Query\Result\QueryType

Expanded class hierarchy of Result

File

src/Solarium/Autocomplete/Result.php, line 11

Namespace

Drupal\search_api_solr\Solarium\Autocomplete
View source
class Result extends BaseResult {

  /**
   * Component results.
   *
   * @var array
   */
  protected $components;

  /**
   * Get all component results.
   *
   * @return array
   *   The component results.
   */
  public function getComponents() {
    $this
      ->parseResponse();
    return $this->components;
  }

  /**
   * Get a component result by key.
   *
   * @param string $key
   *   The component key.
   *
   * @return mixed
   *   The component value.
   */
  public function getComponent($key) {
    $this
      ->parseResponse();
    if (isset($this->components[$key])) {
      return $this->components[$key];
    }
    return NULL;
  }

  /**
   * Get spellcheck component result.
   *
   * This is a convenience method that maps presets to getComponent.
   *
   * @return \Solarium\Component\Result\Spellcheck\Result|null
   *   The spellcheck component result.
   */
  public function getSpellcheck() {
    return $this
      ->getComponent(ComponentAwareQueryInterface::COMPONENT_SPELLCHECK);
  }

  /**
   * Get suggester component result.
   *
   * This is a convenience method that maps presets to getComponent.
   *
   * @return \Solarium\Component\Result\Suggester\Result|null
   *   The suggester component result.
   */
  public function getSuggester() {
    return $this
      ->getComponent(ComponentAwareQueryInterface::COMPONENT_SUGGESTER);
  }

  /**
   * Get terms component result.
   *
   * This is a convenience method that maps presets to getComponent.
   *
   * @return \Solarium\Component\Result\Terms\Result|null
   *   The terms component result.
   */
  public function getTerms() {
    return $this
      ->getComponent(ComponentAwareQueryInterface::COMPONENT_TERMS);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Result::$components protected property Component results.
Result::getComponent public function Get a component result by key.
Result::getComponents public function Get all component results.
Result::getSpellcheck public function Get spellcheck component result.
Result::getSuggester public function Get suggester component result.
Result::getTerms public function Get terms component result.