public function SolrAdminCommandHelper::deleteCollection in Search API Solr 4.x
Delete Solr collection.
Parameters
string $server_id: The ID of the server.
Throws
\Drupal\search_api\SearchApiException
\Drupal\search_api_solr\SearchApiSolrException
File
- modules/
search_api_solr_admin/ src/ Utility/ SolrAdminCommandHelper.php, line 83
Class
- SolrAdminCommandHelper
- Provides functionality to be used by CLI tools.
Namespace
Drupal\search_api_solr_admin\UtilityCode
public function deleteCollection(string $server_id) : void {
$server = $this
->getServer($server_id);
$connector = Utility::getSolrCloudConnector($server);
$result = $connector
->deleteCollection();
if (!$result) {
throw new SearchApiSolrException(sprintf('Reloading %s for %s (%s) failed.', $connector
->isCloud() ? 'collection' : 'core', $server
->label(), $server_id));
}
$this
->reindex($server);
}