protected function add_error($error, $query = NULL) { $message = "Sphinx error \n"; $message .= "User query string: {$this->_user_query_text} \n"; if (!is_null($query)) { $message .= $query . " \n"; } $message .= " --> " . $error . "\n"; vBSphinxSearch_Core::log_errors($message); parent::add_error($message); }
/** * Fetch list of ids by group_id. (For example - all posts by thread id) * * Attention(!) Selection by pure attributes is ineffective in sphinx. * There will be problems for mass threads rebuild. * * This code is for compatibility reasons, if optimised version * not implementer in index controler */ protected function _fetch_object_id_list($group_id, $only_first = false) { if (is_null($this->_content_type_id) or 0 == (int) $group_id) { return false; } $indexes = implode(",", vBSphinxSearch_Core::get_sphinx_index_map($this->_content_type_id)); if (empty($indexes)) { return false; } $limit = vBSphinxSearch_Core::SPH_DEFAULT_RESULTS_LIMIT; $query = 'SELECT * FROM ' . $indexes . ' WHERE contenttypeid = ' . $this->_content_type_id . ' AND groupid = ' . $group_id . ($only_first ? ' AND isfirst = 1' : '') . ' LIMIT ' . $limit . ' OPTION max_matches=' . $limit; $this->_id_list = array(); for ($i = 0; $i < vBSphinxSearch_Core::SPH_RECONNECT_LIMIT; $i++) { $con = vBSphinxSearch_Core::get_sphinxql_conection(); if (false != $con) { $result_res = mysql_query($query, $con); if ($result_res) { while ($docinfo = mysql_fetch_assoc($result_res)) { $this->_id_list[] = $docinfo['primaryid']; } return true; } } } $error = mysql_error(); $message = "\n\nSphinx: Can't get primaryid list for groupid={$group_id}\nUsed indexes: {$indexes}\n Error:\n{$error}\n"; vBSphinxSearch_Core::log_errors($message); return false; }