public function SolrConnectorPluginBase::search in Search API Solr 8
Same name and namespace in other branches
- 8.3 src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::search()
- 8.2 src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::search()
- 4.x src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::search()
Executes a search query and returns the raw response.
Parameters
\Solarium\QueryType\Select\Query\Query $query:
\Solarium\Core\Client\Endpoint|null $endpoint:
Return value
\Solarium\Core\Client\Response
Overrides SolrConnectorInterface::search
1 method overrides SolrConnectorPluginBase::search()
- BasicAuthSolrConnector::search in src/
Plugin/ SolrConnector/ BasicAuthSolrConnector.php - Executes a search query and returns the raw response.
File
- src/
SolrConnector/ SolrConnectorPluginBase.php, line 738
Class
- SolrConnectorPluginBase
- Defines a base class for Solr connector plugins.
Namespace
Drupal\search_api_solr\SolrConnectorCode
public function search(Query $query, Endpoint $endpoint = NULL) {
$this
->connect();
if (!$endpoint) {
$endpoint = $this->solr
->getEndpoint('core');
}
$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');
}
// Use the manual method of creating a Solarium request so we can control
// the HTTP method.
$request = $this->solr
->createRequest($query);
// Set the configured HTTP method.
if ($this->configuration['http_method'] == 'POST') {
$request
->setMethod(Request::METHOD_POST);
}
elseif ($this->configuration['http_method'] == 'GET') {
$request
->setMethod(Request::METHOD_GET);
}
return $this
->executeRequest($request, $endpoint);
}