You are here

protected function SolrConnectorPluginBase::connect in Search API Solr 8

Same name and namespace in other branches
  1. 8.3 src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::connect()
  2. 8.2 src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::connect()
  3. 4.x src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::connect()

Prepares the connection to the Solr server.

23 calls to SolrConnectorPluginBase::connect()
BasicAuthSolrConnector::search in src/Plugin/SolrConnector/BasicAuthSolrConnector.php
Executes a search query and returns the raw response.
SolrConnectorPluginBase::attachServerEndpoint in src/SolrConnector/SolrConnectorPluginBase.php
Attaches an endpoint to the Solr connection to communicate with the server.
SolrConnectorPluginBase::autocomplete in src/SolrConnector/SolrConnectorPluginBase.php
SolrConnectorPluginBase::customizeRequest in src/SolrConnector/SolrConnectorPluginBase.php
SolrConnectorPluginBase::doPing in src/SolrConnector/SolrConnectorPluginBase.php
Pings the Solr server to tell whether it can be accessed.

... See full list

File

src/SolrConnector/SolrConnectorPluginBase.php, line 286

Class

SolrConnectorPluginBase
Defines a base class for Solr connector plugins.

Namespace

Drupal\search_api_solr\SolrConnector

Code

protected function connect() {
  if (!$this->solr) {
    $configuration = $this->configuration;

    // Solr 3 doesn't have the core name in the path. But solarium 6 needs it.
    // The period is a workaround that gives us URLs like "solr/./select".
    if (!$configuration['core']) {
      $configuration['core'] = '.';
    }
    $this->solr = $this
      ->createClient($configuration);
    $this->solr
      ->createEndpoint($this->configuration + [
      'key' => 'core',
    ], TRUE);
    $this
      ->attachServerEndpoint();
  }
}