You are here

protected function SearchApiSolrService::connect in Search API Solr 7

Create a connection to the Solr server as configured in $this->options.

11 calls to SearchApiSolrService::connect()
SearchApiSolrService::commit in includes/service.inc
Sends a commit command to the Solr server.
SearchApiSolrService::deleteItems in includes/service.inc
Implements SearchApiServiceInterface::deleteItems().
SearchApiSolrService::getAutocompleteSuggestions in includes/service.inc
SearchApiSolrService::getExtraInformation in includes/service.inc
Returns additional, service-specific information about this server.
SearchApiSolrService::getFields in includes/service.inc
Get metadata about fields in the Solr/Lucene index.

... See full list

File

includes/service.inc, line 541

Class

SearchApiSolrService
Search service class using Solr server.

Code

protected function connect() {
  if (!$this->solr) {
    $connection_class = $this
      ->getConnectionClass();
    if (!class_exists($connection_class)) {
      throw new SearchApiException(t('Invalid class @class set as Solr connection class.', array(
        '@class' => $connection_class,
      )));
    }
    $options = $this->options + array(
      'server' => $this->server->machine_name,
    );
    $this->solr = new $connection_class($options);
    if (!$this->solr instanceof SearchApiSolrConnectionInterface) {
      $this->solr = NULL;
      throw new SearchApiException(t('Invalid class @class set as Solr connection class.', array(
        '@class' => $connection_class,
      )));
    }
  }
}