You are here

protected function PantheonSolrConnector::connect in Search API Pantheon 8

Prepares the connection to the Solr server.

File

src/Plugin/SolrConnector/PantheonSolrConnector.php, line 150
Provide a connection to Pantheon's Solr instance.

Class

PantheonSolrConnector
Standard Solr connector.

Namespace

Drupal\search_api_pantheon\Plugin\SolrConnector

Code

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

    // The parent method is overridden so that this alternate adapter class
    // can be set. This line is the only difference from the parent method.
    $this->solr
      ->setAdapter('Drupal\\search_api_pantheon\\Solarium\\PantheonCurl');
    $this->solr
      ->createEndpoint($this->configuration + [
      'key' => 'core',
    ], TRUE);
    $this
      ->attachServerEndpoint();
  }
}