You are here

public function Apache_Solr_Service::setPort in Apache Solr Search 5

Set the port used. If empty will fallback to constants

Parameters

integer $port:

1 call to Apache_Solr_Service::setPort()
Apache_Solr_Service::__construct in SolrPhpClient/Apache/Solr/Service.php
Constructor. All parameters are optional and will take on default values if not specified.

File

SolrPhpClient/Apache/Solr/Service.php, line 368

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 setPort($port) {

  //Use the provided port or use the default
  $port = (int) $port;
  if ($port <= 0) {
    throw new Exception('Port is not a valid port number');
  }
  else {
    $this->_port = $port;
  }
  if ($this->_urlsInited) {
    $this
      ->_initUrls();
  }
}