示例#1
0
文件: Search.php 项目: Hikari/Solr
 /**
  * Constructor, retrieve config for connection to solr server.
  */
 public function __construct()
 {
     $_host = Mage::getStoreConfig('solr/server/host');
     $_port = Mage::getStoreConfig('solr/server/port');
     $_path = Mage::getStoreConfig('solr/server/path');
     parent::__construct($_host, $_port, $_path);
 }
示例#2
0
 public function __construct()
 {
     $url = $this->getSolrServerUrl();
     $url = parse_url($url);
     if (isset($url['host']) && isset($url['port']) && isset($url['path'])) {
         parent::__construct($url['host'], $url['port'], $url['path']);
     }
 }
 /**
  * Constructor for class tx_solr_SolrService.
  *
  * @param array|Mage_Core_Model_Config_Element $connectionParameters Must have keys scheme, host, port, path
  */
 public function __construct($connectionParameters)
 {
     if ($connectionParameters instanceof Mage_Core_Model_Config_Element) {
         $connectionParameters = $connectionParameters->asArray();
     }
     $this->setScheme($connectionParameters['scheme'] ?: 'http');
     $solr4CompatibilityLayer = new Apache_Solr_Compatibility_Solr4CompatibilityLayer();
     parent::__construct($connectionParameters['host'], $connectionParameters['port'], $connectionParameters['path'], false, $solr4CompatibilityLayer);
 }
 /**
  * Constructor of BsSolrServiceAdapter class
  * @param string $sProtocol Protocol of Solr service URL
  * @param string $sHost Host of Solr service URL
  * @param string $sPort Port of Solr service URL
  * @param string $sPath Path of Solr service URL
  */
 public function __construct($sProtocol, $sHost, $sPort, $sPath)
 {
     wfProfileIn('BS::' . __METHOD__);
     $this->sProtocol = $sProtocol;
     $this->bUseDifferentProtocolThanHttp = (bool) (strtolower($this->sProtocol) != 'http');
     $this->sUrl = "{$sProtocol}://{$sHost}:{$sPort}{$sPath}/";
     parent::__construct($sHost, $sPort, $sPath);
     wfProfileOut('BS::' . __METHOD__);
 }
 /**
  * Initialize Solr Client
  *
  * @param array $options
  */
 public function __construct($options = array())
 {
     $_optionsNames = array('hostname', 'login', 'password', 'port', 'path');
     if (!sizeof(array_intersect($_optionsNames, array_keys($options)))) {
         Mage::throwException(Mage::helper('enterprise_search')->__('Unable to perform search because of search engine missed configuration.'));
     }
     $this->setUserLogin($options['login']);
     $this->setPassword($options['password']);
     if (isset($options['timeout'])) {
         ini_set('default_socket_timeout', $options['timeout']);
     }
     parent::__construct($options['hostname'], $options['port'], '/' . $options['path'] . '/');
     return $this;
 }
 /**
  * Construct service
  */
 public function __construct()
 {
     $storeId = Mage::app()->getStore()->getId();
     if (Mage::getStoreConfig('catalog/search/engine', $storeId) == 'enterprise_search/engine') {
         $host = Mage::getStoreConfig('catalog/search/solr_server_hostname', $storeId);
         $port = Mage::getStoreConfig('catalog/search/solr_server_port', $storeId);
         $path = Mage::getStoreConfig('catalog/search/solr_server_path', $storeId);
     } else {
         $host = Mage::getStoreConfig('catalog/autocompleterecommendations/solr_server_hostname', $storeId);
         $port = Mage::getStoreConfig('catalog/autocompleterecommendations/solr_server_port', $storeId);
         $path = Mage::getStoreConfig('catalog/autocompleterecommendations/solr_server_path', $storeId);
         if (!$host || !$port || !$path) {
             $message = Mage::helper('autocompleterecommendations')->__('Solr engine parameters, host, port and path are required.');
             Mage::log($message, null, 'extensions_store_autocompleterecommendations.log');
             Mage::throwException($message);
             die;
         }
     }
     parent::__construct($host, $port, $path);
 }
 /**
  * Put Luke meta-data from the cache into $this->luke when we instantiate.
  *
  * @see Apache_Solr_Service::__construct()
  */
 public function __construct($host = 'localhost', $port = 8180, $path = '/solr/')
 {
     parent::__construct($host, $port, $path);
     $this->luke_cid = "apachesolr:luke:" . md5($this->_lukeUrl);
     $cache = cache_get($this->luke_cid);
     if (isset($cache->data)) {
         $this->luke = $cache->data;
     }
 }
示例#8
0
 /**
  * Constructor
  *
  * @param string $host Solr host
  * @param string $port Solr port
  * @param string $path Solr path
  * @param string $scheme Scheme, defaults to http, can be https
  */
 public function __construct($host = '', $port = '8080', $path = '/solr/', $scheme = 'http')
 {
     $this->setScheme($scheme);
     $this->configuration = Util::getSolrConfiguration();
     parent::__construct($host, $port, $path);
 }
示例#9
0
 /**
  * Constructor
  *
  * @param string $host Solr host
  * @param string $port Solr port
  * @param string $path Solr path
  * @param string $scheme Scheme, defaults to http, can be https
  */
 public function __construct($host = '', $port = '8080', $path = '/solr/', $scheme = 'http')
 {
     $this->setScheme($scheme);
     parent::__construct($host, $port, $path);
 }
示例#10
0
 public function __construct($host = 'localhost', $port = 8180, $path = '/solr/')
 {
     parent::__construct($host, $port, $path);
     echo '<pre>' . print_r($this->ping(), true) . '</pre>';
     exit;
 }