public function SolrConnectorPluginBase::search in Search API Solr 4.x
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()
- 8.2 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: 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::search
1 call to SolrConnectorPluginBase::search()
- Solr36Connector::search in modules/
search_api_solr_legacy/ src/ Plugin/ SolrConnector/ Solr36Connector.php - Executes a search query and returns the raw response.
1 method overrides SolrConnectorPluginBase::search()
- Solr36Connector::search in modules/
search_api_solr_legacy/ src/ Plugin/ SolrConnector/ Solr36Connector.php - Executes a search query and returns the raw response.
File
- src/
SolrConnector/ SolrConnectorPluginBase.php, line 851
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();
}
$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);
}