Ejemplo n.º 1
0
 /**
  * Overwrite template paths to only use the path defined on the yaml file
  * @see SolrIndex::getTemplatesPath
  */
 public function getTemplatesPath()
 {
     $options = Config::inst()->get('FAQSearchIndex', 'options');
     $globalOptions = Solr::solr_options();
     if (isset($options['templatespath']) && file_exists($options['templatespath'])) {
         $globalOptions['templatespath'] = $options['templatespath'];
     }
     return $this->templatesPath ? $this->templatesPath : $globalOptions['templatespath'];
 }
 function __construct($config)
 {
     $options = Solr::solr_options();
     $this->url = implode('', array('http://', isset($config['auth']) ? $config['auth'] . '@' : '', $options['host'] . ':' . $options['port'], $config['path']));
     $this->remote = $config['remotepath'];
 }
 /**
  * @return String Absolute path to the configuration default files,
  * e.g. solrconfig.xml.
  */
 function getExtrasPath()
 {
     $globalOptions = Solr::solr_options();
     return $this->extrasPath ? $this->extrasPath : $globalOptions['extraspath'];
 }
 /**
  * Get config store
  * 
  * @return SolrConfigStore
  */
 protected function getSolrConfigStore()
 {
     $options = Solr::solr_options();
     if (!isset($options['indexstore']) || !($indexstore = $options['indexstore'])) {
         user_error('No index configuration for Solr provided', E_USER_ERROR);
     }
     // Find the IndexStore handler, which will handle uploading config files to Solr
     $mode = $indexstore['mode'];
     if ($mode == 'file') {
         return new SolrConfigStore_File($indexstore);
     } elseif ($mode == 'webdav') {
         return new SolrConfigStore_WebDAV($indexstore);
     } elseif (ClassInfo::exists($mode) && ClassInfo::classImplements($mode, 'SolrConfigStore')) {
         return new $mode($indexstore);
     } else {
         user_error('Unknown Solr index mode ' . $indexstore['mode'], E_USER_ERROR);
     }
 }