예제 #1
0
파일: Factory.php 프로젝트: bellodox/jsolr
 /**
  * Gets a connection to the Solr Service using settings from the specified
  * component.
  *
  * @return Apache\Solr\Service A connection to the Solr Service.
  * @throws Exception An exception when a connection issue occurs.
  */
 public static function getService()
 {
     $params = self::getConfig();
     $url = $params->get('host');
     if ($params->get('username') && $params->get('password')) {
         $url = $params->get('username') . ":" . $params->get('password') . "@" . $url;
     }
     $service = new Apache\Solr\Service($url, $params->get('port'), $params->get('path'));
     if (!$service->ping()) {
         throw new \Exception('Could not contact the index server.', 503);
     }
     return $service;
 }
예제 #2
0
파일: Balancer.php 프로젝트: bellodox/jsolr
 /**
  * Convenience function for creating phrase syntax from a value
  *
  * @param string $value
  * @return string
  */
 public static function phrase($value)
 {
     return \JSolr\Apache\Solr\Service::phrase($value);
 }