You are here

public function DrupalApacheSolrService::__construct in Apache Solr Search 6.3

Same name and namespace in other branches
  1. 8 Drupal_Apache_Solr_Service.php \DrupalApacheSolrService::__construct()
  2. 7 Drupal_Apache_Solr_Service.php \DrupalApacheSolrService::__construct()

Constructor

Parameters

$url: The URL to the Solr server, possibly including a core name. E.g. http://localhost:8983/solr/ or https://search.example.com/solr/core99/

$env_id: The machine name of a corresponding saved configuration used for loading data like which facets are enabled.

Overrides DrupalApacheSolrServiceInterface::__construct

File

./Drupal_Apache_Solr_Service.php, line 401

Class

DrupalApacheSolrService
Starting point for the Solr API. Represents a Solr server resource and has methods for pinging, adding, deleting, committing, optimizing and searching.

Code

public function __construct($url, $env_id = NULL) {
  $this->env_id = $env_id;
  $this
    ->setUrl($url);

  // determine our default http timeout from ini settings
  $this->_defaultTimeout = (int) ini_get('default_socket_timeout');

  // double check we didn't get 0 for a timeout
  if ($this->_defaultTimeout <= 0) {
    $this->_defaultTimeout = 60;
  }
}