public function StandardSolrCloudConnector::getClusterStatus in Search API Solr 4.x
Gets information about the cluster status of a Solr Collection.
Parameters
string|null $collection: Collection.
Return value
ClusterState|null A response object with system information.
Throws
\Drupal\search_api_solr\SearchApiSolrException
Overrides SolrCloudConnectorInterface::getClusterStatus
1 call to StandardSolrCloudConnector::getClusterStatus()
- StandardSolrCloudConnector::getConfigSetName in src/
Plugin/ SolrConnector/ StandardSolrCloudConnector.php - Gets the name of the used configset.
File
- src/
Plugin/ SolrConnector/ StandardSolrCloudConnector.php, line 198
Class
- StandardSolrCloudConnector
- Standard Solr Cloud connector.
Namespace
Drupal\search_api_solr\Plugin\SolrConnectorCode
public function getClusterStatus(?string $collection = NULL) : ?ClusterState {
$this
->connect();
$this
->useTimeout(self::INDEX_TIMEOUT);
try {
$collection = $collection ?? $this->configuration['core'];
$query = $this->solr
->createCollections();
$action = $query
->createClusterStatus();
$action
->setCollection($this->configuration['core']);
$query
->setAction($action);
$response = $this->solr
->collections($query);
return $response
->getWasSuccessful() ? $response
->getClusterState() : NULL;
} catch (HttpException $e) {
throw new SearchApiSolrException(sprintf('Get ClusterStatus for collection %s failed with error code %s: %s', $collection, $e
->getCode(), $e
->getMessage()), $e
->getCode(), $e);
}
}