git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@285 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
nanosimbiot 2011-09-05 10:07:00 +00:00
commit 12a888cbf0
3 changed files with 6 additions and 11 deletions

View file

@ -2611,12 +2611,11 @@ function log_sphinx_error ($err_type, $err_msg, $query = '')
} }
} }
function get_title_match_topics ($title_match_sql, $limit = 500, $forum_ids = array()) function get_title_match_topics ($title_match_sql, $forum_ids = array())
{ {
global $bb_cfg, $sphinx, $userdata, $title_match; global $bb_cfg, $sphinx, $userdata, $title_match;
$where_ids = array(); $where_ids = array();
$limit = (int) $limit;
if($forum_ids) $forum_ids = array_diff($forum_ids, array(0 => 0)); if($forum_ids) $forum_ids = array_diff($forum_ids, array(0 => 0));
$title_match_sql = encode_text_match($title_match_sql); $title_match_sql = encode_text_match($title_match_sql);
@ -2627,7 +2626,6 @@ function get_title_match_topics ($title_match_sql, $limit = 500, $forum_ids = ar
$where = ($title_match) ? 'topics' : 'posts'; $where = ($title_match) ? 'topics' : 'posts';
$sphinx->SetServer($bb_cfg['sphinx_topic_titles_host'], $bb_cfg['sphinx_topic_titles_port']); $sphinx->SetServer($bb_cfg['sphinx_topic_titles_host'], $bb_cfg['sphinx_topic_titles_port']);
$sphinx->SetLimits(0, $limit, $limit, $limit);
if ($forum_ids) if ($forum_ids)
{ {
$sphinx->SetFilter('forum_id', $forum_ids, false); $sphinx->SetFilter('forum_id', $forum_ids, false);
@ -2666,8 +2664,7 @@ function get_title_match_topics ($title_match_sql, $limit = 500, $forum_ids = ar
$where_id = 'topic_id'; $where_id = 'topic_id';
$sql = "SELECT topic_id FROM ". BB_TOPICS ." $sql = "SELECT topic_id FROM ". BB_TOPICS ."
WHERE MATCH (topic_title) AGAINST ('$title_match_sql'$search_bool_mode) WHERE MATCH (topic_title) AGAINST ('$title_match_sql'$search_bool_mode)
$where_forum $where_forum";
LIMIT $limit";
} }
else else
{ {
@ -2675,8 +2672,7 @@ function get_title_match_topics ($title_match_sql, $limit = 500, $forum_ids = ar
$sql = "SELECT p.post_id FROM ". BB_POSTS ." p, ". BB_POSTS_SEARCH ." ps $sql = "SELECT p.post_id FROM ". BB_POSTS ." p, ". BB_POSTS_SEARCH ." ps
WHERE ps.post_id = p.post_id WHERE ps.post_id = p.post_id
AND MATCH (ps.search_words) AGAINST ('$title_match_sql'$search_bool_mode) AND MATCH (ps.search_words) AGAINST ('$title_match_sql'$search_bool_mode)
$where_forum $where_forum";
LIMIT $limit";
} }
foreach (DB()->fetch_rowset($sql) as $row) foreach (DB()->fetch_rowset($sql) as $row)

View file

@ -452,7 +452,7 @@ if ($post_mode)
if ($text_match_sql) if ($text_match_sql)
{ {
$search_match_topics_csv = ''; $search_match_topics_csv = '';
$title_match_topics = get_title_match_topics($text_match_sql, 500, $forum_selected); $title_match_topics = get_title_match_topics($text_match_sql, $forum_selected);
if (!$search_match_topics_csv = join(',', $title_match_topics)) if (!$search_match_topics_csv = join(',', $title_match_topics))
{ {
@ -623,7 +623,7 @@ else
if ($text_match_sql) if ($text_match_sql)
{ {
$search_match_topics_csv = ''; $search_match_topics_csv = '';
$title_match_topics = get_title_match_topics($text_match_sql, 500, $forum_selected); $title_match_topics = get_title_match_topics($text_match_sql, $forum_selected);
if (!$search_match_topics_csv = join(',', $title_match_topics)) if (!$search_match_topics_csv = join(',', $title_match_topics))
{ {

View file

@ -17,7 +17,6 @@ $page_cfg['load_tpl_vars'] = array(
$user->session_start(array('req_login' => $bb_cfg['bt_tor_browse_only_reg'])); $user->session_start(array('req_login' => $bb_cfg['bt_tor_browse_only_reg']));
$tor_search_limit = (IS_AM) ? 2000 : 500; $tor_search_limit = (IS_AM) ? 2000 : 500;
$title_match_limit = 700; // больше $tor_search_limit т.к. ищет по всем темам, а не только по раздачам
$forum_select_size = (UA_OPERA) ? 21 : 24; // forum select box max rows $forum_select_size = (UA_OPERA) ? 21 : 24; // forum select box max rows
$max_forum_name_len = 60; // inside forum select box $max_forum_name_len = 60; // inside forum select box
$max_forums_selected = 50; $max_forums_selected = 50;
@ -504,7 +503,7 @@ if ($allowed_forums)
if ($title_match) if ($title_match)
{ {
$title_match_topics = get_title_match_topics($title_match_sql, $title_match_limit, $search_in_forums_ary); $title_match_topics = get_title_match_topics($title_match_sql, $search_in_forums_ary);
if (!$search_match_topics_csv = join(',', $title_match_topics)) if (!$search_match_topics_csv = join(',', $title_match_topics))
{ {