public function SolrConnectorPluginBase::search in Search API Solr 8.2
Same name and namespace in other branches
- 8.3 src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::search()
- 8 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
File
- src/
SolrConnector/ SolrConnectorPluginBase.php, line 751
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');
}
// 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);
}