setServer() public method

Set searchd host name and port
public setServer ( string $host, integer $port ) : SphinxClient
$host string
$port integer
return SphinxClient
 /**
  * Constructor
  *
  * @param string $host   Sphinx host
  * @param string $port   Sphinx port
  * @param string $socket UNIX socket. Not required
  *
  * @throws NoSphinxAPIException If class SphinxClient does not exists
  */
 public function __construct($host, $port, $socket = null)
 {
     $this->host = $host;
     $this->port = $port;
     $this->socket = $socket;
     $this->sphinx = new SphinxClient();
     if (!is_null($this->socket)) {
         $this->sphinx->setServer($this->socket);
     } else {
         $this->sphinx->setServer($this->host, $this->port);
     }
 }
Esempio n. 2
0
 public function testSetServerWithoutPortShouldSetDefaultPort()
 {
     $sphinx = new SphinxClient();
     $sphinx->setServer('localhost');
     $this->assertSame($sphinx->port, 9312);
 }
 /**
  * {@inheritdoc}
  */
 public function setServer($host, $port = 0)
 {
     return $this->proxy->setServer($host, $port);
 }