You are here

public function SolrAdminCommandHelper::reload in Search API Solr 4.x

Reload Solr core or collection.

Parameters

string $server_id: The ID of the server.

Throws

\Drupal\search_api\SearchApiException

\Drupal\search_api_solr\SearchApiSolrException

1 call to SolrAdminCommandHelper::reload()
SolrAdminCommandHelper::uploadConfigset in modules/search_api_solr_admin/src/Utility/SolrAdminCommandHelper.php
Generates and uploads the configset for a Solr search server.

File

modules/search_api_solr_admin/src/Utility/SolrAdminCommandHelper.php, line 64

Class

SolrAdminCommandHelper
Provides functionality to be used by CLI tools.

Namespace

Drupal\search_api_solr_admin\Utility

Code

public function reload(string $server_id) : void {
  $server = $this
    ->getServer($server_id);
  $connector = Utility::getSolrConnector($server);
  $result = $connector
    ->reloadCore();
  if (!$result) {
    throw new SearchApiSolrException(sprintf('Reloading %s for %s (%s) failed.', $connector
      ->isCloud() ? 'collection' : 'core', $server
      ->label(), $server_id));
  }
  $this
    ->reindex($server);
}