You are here

public function SolrConnectorPluginBase::autocomplete in Search API Solr 4.x

Same name and namespace in other branches
  1. 8 src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::autocomplete()

Executes a search query and returns the raw response.

Parameters

\Drupal\search_api_solr\Solarium\Autocomplete\Query $query: The Solarium select query object.

\Solarium\Core\Client\Endpoint|null $endpoint: (optional) The Solarium endpoint object.

Return value

\Solarium\Core\Client\Response The Solarium response object.

Throws

\Drupal\search_api_solr\SearchApiSolrException

Overrides SolrConnectorInterface::autocomplete

File

src/SolrConnector/SolrConnectorPluginBase.php, line 927

Class

SolrConnectorPluginBase
Defines a base class for Solr connector plugins.

Namespace

Drupal\search_api_solr\SolrConnector

Code

public function autocomplete(AutocompleteQuery $query, ?Endpoint $endpoint = NULL) {
  $this
    ->connect();
  if (!$endpoint) {
    $endpoint = $this->solr
      ->getEndpoint();
  }
  $this
    ->useTimeout(self::QUERY_TIMEOUT, $endpoint);

  // Use the 'postbigrequest' plugin if no specific http method is
  // configured. The plugin needs to be loaded before the request is
  // created.
  if ($this->configuration['http_method'] === 'AUTO') {
    $this->solr
      ->getPlugin('postbigrequest');
  }
  return $this
    ->execute($query, $endpoint);
}