/** * Передает текущие параметры элемента поиска API SphinxClient. * Необходимо определить все переменные до вызова этой функции (например, в перегруженной версии). */ public function setEngine() { $this->_engine->SetServer($this->_host, $this->_port); $this->_engine->SetLimits($this->_offset, $this->_limit, $this->_maxmatches, $this->_cutoff); $this->_engine->SetMaxQueryTime($this->_maxquerytime); $this->_engine->SetRankingMode($this->_ranker); $this->_engine->SetMatchMode($this->_mode); $this->_engine->SetFieldWeights($this->_fieldweights); $this->_engine->SetIndexWeights($this->_indexweights); $this->_engine->SetRetries($this->_retrycount, $this->_retrydelay); $this->_engine->SetArrayResult($this->_arrayresult); $this->_engine->ResetFilters(); $this->_engine->ResetGroupBy(); $this->_engine->ResetOverrides(); $this->_engine->SetIDRange($this->_min_id, $this->_max_id); $this->_engine->SetSelect($this->_select); if ($this->_overrides) { call_user_func_array(array($this->_engine, 'SetOverride'), $this->_overrides); } if ($this->_anchor) { call_user_func_array(array($this->_engine, 'SetGeoAnchor'), $this->_anchor); } foreach ($this->_filtersV as $f) { call_user_func_array(array($this->_engine, 'SetFilter'), $f); } foreach ($this->_filtersR as $f) { call_user_func_array(array($this->_engine, 'SetFilterRange'), $f); } foreach ($this->_filtersRF as $f) { call_user_func_array(array($this->_engine, 'SetFilterFloatRange'), $f); } $this->_engine->SetGroupBy($this->_groupby, $this->_groupfunc, $this->_groupsort); $this->_engine->SetGroupDistinct($this->_groupdistinct); $this->_engine->SetSortMode($this->_sort, $this->_sortby); }
/** * Setup registry objects * * @access public * @param object ipsRegistry $registry * @return @e void */ public function __construct(ipsRegistry $registry) { /* Make object */ $this->registry = $registry; $this->DB = $this->registry->DB(); $this->settings =& $this->registry->fetchSettings(); $this->request =& $this->registry->fetchRequest(); $this->lang = $this->registry->getClass('class_localization'); $this->member = $this->registry->member(); $this->memberData =& $this->registry->member()->fetchMemberData(); $this->cache = $this->registry->cache(); $this->caches =& $this->registry->cache()->fetchCaches(); /* Do we have the sphinxes? */ if (!is_file(DOC_IPS_ROOT_PATH . 'sphinxapi.php')) { $registry->output->showError('sphinx_api_missing', 10182); } /* Load Sphinx */ require_once DOC_IPS_ROOT_PATH . 'sphinxapi.php'; /*noLibHook*/ $this->sphinxClient = new SphinxClient(); $this->sphinxClient->SetServer($this->settings['search_sphinx_server'], intval($this->settings['search_sphinx_port'])); $this->sphinxClient->SetMatchMode(SPH_MATCH_EXTENDED); $this->sphinxClient->SetLimits(0, 1000); }
/** * Setup registry objects * * @access public * @param object ipsRegistry $registry * @return void */ public function __construct(ipsRegistry $registry) { $this->DB = $registry->DB(); $this->member = $registry->member(); $this->memberData =& $registry->member()->fetchMemberData(); $this->settings = $registry->settings(); $this->request = $registry->request(); /* Do we have the sphinxes? */ if (!file_exists('sphinxapi.php')) { $registry->output->showError('sphinx_api_missing', 10182); } /* Load Sphinx */ require 'sphinxapi.php'; $this->sphinxClient = new SphinxClient(); $this->sphinxClient->SetServer($this->settings['search_sphinx_server'], intval($this->settings['search_sphinx_port'])); $this->sphinxClient->SetMatchMode(SPH_MATCH_EXTENDED); $this->sphinxClient->SetLimits(0, 1000); /* We're going to need the regular app index plugin also */ require_once IPSLib::getAppDir(ipsRegistry::$request['search_app']) . '/extensions/searchPlugin.php'; $searchApp = 'search' . ucfirst($this->request['search_app']) . 'Plugin'; $this->appSearchPlugin = new $searchApp($registry); }