You are here

public static function Utility::getSolrConnector in Search API Solr 4.x

Gets the Solr connector configured for a server.

Parameters

\Drupal\search_api\ServerInterface $server: The Search API Server.

Return value

\Drupal\search_api_solr\SolrConnectorInterface

Throws

\Drupal\search_api\SearchApiException

\Drupal\search_api_solr\SearchApiSolrException

2 calls to Utility::getSolrConnector()
SolrAdminCommandHelper::reload in modules/search_api_solr_admin/src/Utility/SolrAdminCommandHelper.php
Reload Solr core or collection.
Utility::getSolrCloudConnector in src/Utility/Utility.php
Gets the Solr Cloud connector configured for a server.

File

src/Utility/Utility.php, line 1173

Class

Utility
Provides various helper functions for Solr backends.

Namespace

Drupal\search_api_solr\Utility

Code

public static function getSolrConnector(ServerInterface $server) : SolrConnectorInterface {
  $backend = $server
    ->getBackend();
  if (!$backend instanceof SolrBackendInterface) {
    throw new SearchApiSolrException(sprintf('Server %s is not a Solr server', $server
      ->label()));
  }
  return $backend
    ->getSolrConnector();
}