function _searchUseSphinx($conditions, $page = 1, $perpage = 20) { if (!$conditions || !$conditions['keywords']) { return false; } $keywords = $conditions['keywords']; $keywords = $this->_checkKeywordCondition($keywords); if (!$keywords) { return array(false); } $page = $page > 1 ? intval($page) : 1; $offset = intval(($page - 1) * $perpage); require_once R_P . "lib/search/search/sphinx.search.php"; $_sphinxSearch = new Search_Sphinx(); $conditions['keywords'] = $keywords; $conditions['offset'] = $offset; $conditions['perpage'] = $perpage; $conditions['index'] = isset($this->_sphinx['weiboindex']) ? $this->_sphinx['weiboindex'] : 'weiboindex'; $conditions['sortby'] = 'postdate'; $result = $_sphinxSearch->sphinxSearcher($conditions, 'id'); $total = $result[0]; $searchs = $this->_getCmsByIds($result[1], $keywords); return array($total, $searchs); }
function _searchUseSphinx($conditions, $page = 1, $perpage = 20) { if (!$conditions || !$conditions['keywords']) { return false; } $keywords = $conditions['keywords']; $keywords = $this->_checkKeywordCondition($keywords); if (!$keywords) { return array(false); } $page = $page > 1 ? intval($page) : 1; $offset = intval(($page - 1) * $perpage); require_once R_P . "lib/search/search/sphinx.search.php"; $_sphinxSearch = new Search_Sphinx(); $conditions['keywords'] = $keywords; $conditions['offset'] = $offset; $conditions['perpage'] = $perpage; $conditions['index'] = isset($this->_sphinx['cmsindex']) ? $this->_sphinx['cmsindex'] : 'cmsindex'; $conditions['sortby'] = 'postdate'; if ($this->_groupId != 3) { $conditions['filterRange'] = array(array('attribute' => 'postdate', 'min' => 0, 'max' => $this->_timestamp, 'exclude' => false)); } $result = $_sphinxSearch->sphinxSearcher($conditions, 'id'); $total = $result[0]; $searchs = $this->_getCmsByIds($result[1], $keywords); return array($total, $searchs); }