public function StandardSolrCloudConnector::reloadCollection in Search API Solr 8.3
Same name and namespace in other branches
- 4.x 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
1 call to StandardSolrCloudConnector::reloadCollection()
- StandardSolrCloudConnector::reloadCore in src/
Plugin/ SolrConnector/ StandardSolrCloudConnector.php - Reloads the Solr core.
File
- src/
Plugin/ SolrConnector/ StandardSolrCloudConnector.php, line 286
Class
- StandardSolrCloudConnector
- Standard Solr Cloud connector.
Namespace
Drupal\search_api_solr\Plugin\SolrConnectorCode
public function reloadCollection(?string $collection = NULL) {
$this
->connect();
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
->getCode(), $e);
}
}