public function StandardSolrCloudConnector::reloadCollection in Search API Solr 4.x
Same name and namespace in other branches
- 8.3 src/Plugin/SolrConnector/StandardSolrCloudConnector.php \Drupal\search_api_solr\Plugin\SolrConnector\StandardSolrCloudConnector::reloadCollection()
Reloads collection.
Parameters
string|null $collection: Collection.
Return value
bool TRUE if successful, FALSE otherwise.
Throws
\Drupal\search_api_solr\SearchApiSolrException
Overrides SolrCloudConnectorInterface::reloadCollection
1 call to StandardSolrCloudConnector::reloadCollection()
- StandardSolrCloudConnector::reloadCore in src/
Plugin/ SolrConnector/ StandardSolrCloudConnector.php - Reloads the Solr core.
File
- src/
Plugin/ SolrConnector/ StandardSolrCloudConnector.php, line 361
Class
- StandardSolrCloudConnector
- Standard Solr Cloud connector.
Namespace
Drupal\search_api_solr\Plugin\SolrConnectorCode
public function reloadCollection(?string $collection = NULL) : bool {
$this
->connect();
$this
->useTimeout(self::INDEX_TIMEOUT);
try {
$collection = $collection ?? $this->configuration['core'];
$query = $this->solr
->createCollections();
$action = $query
->createReload([
'name' => $collection,
]);
$query
->setAction($action);
$response = $this->solr
->collections($query);
return $response
->getWasSuccessful();
} catch (HttpException $e) {
throw new SearchApiSolrException("Reloading collection {$collection} failed with error code " . $e
->getCode() . ': ' . $e
->getMessage(), $e
->getCode(), $e);
}
}