示例#1
0
 /**
  * Gets the solr client instance
  * @return SolrClient the solr client
  */
 public function getClient()
 {
     if ($this->_writeConnection === null) {
         if ($this->_readConnection === null) {
             return null;
         } else {
             return $this->_readConnection->getClient();
         }
     } else {
         return $this->_writeConnection->getClient();
     }
 }
示例#2
0
 /**
  * Tests the client options
  * @expectedException SolrIllegalArgumentException
  */
 public function testClientOptions()
 {
     $connection = new ASolrConnection();
     $connection->clientOptions->hostname = SOLR_HOSTNAME;
     $connection->clientOptions->port = SOLR_PORT;
     $connection->clientOptions->path = SOLR_PATH;
     $client = $connection->getClient();
     $this->assertTrue($client instanceof SolrClient);
     $connection->clientOptions = array();
     $connection->setClient(null);
     $connection->getClient();
     // should throw an exception
 }