Esempio n. 1
0
 /**
  * Constructor. Initialise some details about the server
  *
  * @access  public
  */
 public function __construct()
 {
     // Call base class constructor
     parent::__construct();
     global $configArray;
     global $timer;
     // Include our solr index
     $class = $configArray['Genealogy']['engine'];
     require_once "sys/{$class}.php";
     $this->searchType = 'genealogy';
     $this->basicSearchType = 'genealogy';
     // Initialise the index
     $this->indexEngine = new $class($configArray['Genealogy']['url'], $configArray['Genealogy']['default_core']);
     $timer->logTime('Created Index Engine for Genealogy');
     //Make sure to turn off sharding for genealogy
     $this->indexEngine->setShards(array());
     // Get default facet settings
     $this->allFacetSettings = getExtraConfigArray('genealogyFacets');
     $this->facetConfig = array();
     $facetLimit = $this->getFacetSetting('Results_Settings', 'facet_limit');
     if (is_numeric($facetLimit)) {
         $this->facetLimit = $facetLimit;
     }
     $translatedFacets = $this->getFacetSetting('Advanced_Settings', 'translated_facets');
     if (is_array($translatedFacets)) {
         $this->translatedFacets = $translatedFacets;
     }
     // Load search preferences:
     $searchSettings = getExtraConfigArray('genealogySearches');
     $this->defaultIndex = 'GenealogyKeyword';
     if (isset($searchSettings['General']['default_sort'])) {
         $this->defaultSort = $searchSettings['General']['default_sort'];
     }
     if (isset($searchSettings['DefaultSortingByType']) && is_array($searchSettings['DefaultSortingByType'])) {
         $this->defaultSortByType = $searchSettings['DefaultSortingByType'];
     }
     if (isset($searchSettings['Basic_Searches'])) {
         $this->basicTypes = $searchSettings['Basic_Searches'];
     }
     if (isset($searchSettings['Advanced_Searches'])) {
         $this->advancedTypes = $searchSettings['Advanced_Searches'];
     }
     // Load sort preferences (or defaults if none in .ini file):
     if (isset($searchSettings['Sorting'])) {
         $this->sortOptions = $searchSettings['Sorting'];
     } else {
         $this->sortOptions = array('relevance' => 'sort_relevance', 'year' => 'sort_year', 'year asc' => 'sort_year asc', 'title' => 'sort_title');
     }
     // Load Spelling preferences
     $this->spellcheck = $configArray['Spelling']['enabled'];
     $this->spellingLimit = $configArray['Spelling']['limit'];
     $this->spellSimple = $configArray['Spelling']['simple'];
     $this->spellSkipNumeric = isset($configArray['Spelling']['skip_numeric']) ? $configArray['Spelling']['skip_numeric'] : true;
     // Debugging
     $this->indexEngine->debug = $this->debug;
     $this->recommendIni = 'genealogySearches';
     $timer->logTime('Setup Solr Search Object');
 }