public function Apache_Solr_Service::__construct in Apache Solr Search 5
Constructor. All parameters are optional and will take on default values if not specified.
Parameters
string $host:
string $port:
string $path:
File
- SolrPhpClient/
Apache/ Solr/ Service.php, line 200
Class
- Apache_Solr_Service
- 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($host = 'localhost', $port = 8180, $path = '/solr/') {
$this
->setHost($host);
$this
->setPort($port);
$this
->setPath($path);
$this
->_initUrls();
//set up the stream context for posting with file_get_contents
$contextOpts = array(
'http' => array(
'method' => 'POST',
'header' => "Content-Type: text/xml; charset=UTF-8\r\n",
),
);
$this->_postContext = stream_context_create($contextOpts);
}