mirror of
https://github.com/phpbb/phpbb.git
synced 2025-03-13 20:28:44 +01:00
- fixed a parse error (oops)
- pass forum_ids to search indexing functions - fixed a bug in fulltext_native's cache destroying git-svn-id: file:///svn/phpbb/trunk@6152 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
a5c23243c7
commit
c6227ad5b0
@ -267,7 +267,7 @@ class acp_search
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = 'SELECT post_id, poster_id
|
||||
$sql = 'SELECT post_id, poster_id, forum_id
|
||||
FROM ' . POSTS_TABLE . '
|
||||
WHERE post_id >= ' . (int) ($post_counter + 1) . '
|
||||
AND post_id < ' . (int) ($post_counter + $this->batch_size);
|
||||
@ -278,12 +278,13 @@ class acp_search
|
||||
{
|
||||
$ids[] = $row['post_id'];
|
||||
$posters[] = $row['poster_id'];
|
||||
$forum_ids[] = $row['forum_id'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (sizeof($ids))
|
||||
{
|
||||
$this->search->index_remove($ids, $posters);
|
||||
$this->search->index_remove($ids, $posters, $forum_ids);
|
||||
}
|
||||
|
||||
$post_counter += $this->batch_size;
|
||||
@ -318,7 +319,7 @@ class acp_search
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = 'SELECT post_id, post_subject, post_text, poster_id
|
||||
$sql = 'SELECT post_id, post_subject, post_text, poster_id, forum_id
|
||||
FROM ' . POSTS_TABLE . '
|
||||
WHERE post_id >= ' . (int) ($post_counter + 1) . '
|
||||
AND post_id < ' . (int) ($post_counter + $this->batch_size);
|
||||
@ -326,7 +327,7 @@ class acp_search
|
||||
|
||||
while (false !== ($row = $db->sql_fetchrow($result)))
|
||||
{
|
||||
$this->search->index('post', $row['post_id'], $row['post_text'], $row['post_subject'], $row['poster_id']);
|
||||
$this->search->index('post', $row['post_id'], $row['post_text'], $row['post_subject'], $row['poster_id'], $row['forum_id']);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
|
@ -361,7 +361,7 @@ function filelist($rootdir, $dir = '', $type = 'gif|jpg|jpeg|png')
|
||||
return $matches;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Move topic(s)
|
||||
*/
|
||||
function move_topics($topic_ids, $forum_id, $auto_sync = true)
|
||||
@ -621,7 +621,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
|
||||
trigger_error($error);
|
||||
}
|
||||
|
||||
$search->index_remove($post_ids, $poster_ids);
|
||||
$search->index_remove($post_ids, $poster_ids, $forum_ids);
|
||||
|
||||
delete_attachments('post', $post_ids, false);
|
||||
|
||||
|
@ -1844,7 +1844,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
trigger_error($error);
|
||||
}
|
||||
|
||||
$search->index($mode, $data['post_id'], $data['message'], $subject, $poster_id);
|
||||
$search->index($mode, $data['post_id'], $data['message'], $subject, $poster_id, ($topic_type == POST_GLOBAL) ? 0 : $data['forum_id']);
|
||||
}
|
||||
|
||||
$db->sql_transaction('commit');
|
||||
|
@ -555,7 +555,7 @@ class fulltext_mysql extends search_backend
|
||||
*
|
||||
* @param string $mode contains the post mode: edit, post, reply, quote ...
|
||||
*/
|
||||
function index($mode, $post_id, &$message, &$subject, $poster_id)
|
||||
function index($mode, $post_id, &$message, &$subject, $poster_id, $forum_id)
|
||||
{
|
||||
global $db;
|
||||
|
||||
@ -606,7 +606,7 @@ class fulltext_mysql extends search_backend
|
||||
/**
|
||||
* Destroy cached results, that might be outdated after deleting a post
|
||||
*/
|
||||
function index_remove($post_ids, $author_ids)
|
||||
function index_remove($post_ids, $author_ids, $forum_ids)
|
||||
{
|
||||
$this->destroy_cache(array(), $author_ids);
|
||||
}
|
||||
|
@ -750,7 +750,7 @@ class fulltext_native extends search_backend
|
||||
*
|
||||
* @param string $mode contains the post mode: edit, post, reply, quote ...
|
||||
*/
|
||||
function index($mode, $post_id, &$message, &$subject, $poster_id)
|
||||
function index($mode, $post_id, &$message, &$subject, $poster_id, $forum_id)
|
||||
{
|
||||
global $config, $db;
|
||||
|
||||
@ -922,7 +922,7 @@ class fulltext_native extends search_backend
|
||||
/**
|
||||
* Removes entries from the wordmatch table for the specified post_ids
|
||||
*/
|
||||
function index_remove($post_ids, $author_ids)
|
||||
function index_remove($post_ids, $author_ids, $forum_ids)
|
||||
{
|
||||
global $db;
|
||||
|
||||
@ -956,7 +956,7 @@ class fulltext_native extends search_backend
|
||||
// Remove common (> 60% of posts ) words
|
||||
if ($config['num_posts'] >= 100)
|
||||
{
|
||||
$sql = 'SELECT word_id
|
||||
$sql = 'SELECT word_id, word_text
|
||||
FROM ' . SEARCH_WORDMATCH_TABLE . '
|
||||
GROUP BY word_id
|
||||
HAVING COUNT(word_id) > ' . floor($config['num_posts'] * 0.6);
|
||||
@ -968,11 +968,10 @@ class fulltext_native extends search_backend
|
||||
do
|
||||
{
|
||||
$sql_in[] = $row['word_id'];
|
||||
$destroy_cache_words[] = $row['word_text'];
|
||||
}
|
||||
while ($row = $db->sql_fetchrow($result));
|
||||
|
||||
$destroy_cache_words = $sql_in;
|
||||
|
||||
$sql_in = implode(', ', $sql_in);
|
||||
|
||||
$sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . "
|
||||
@ -989,7 +988,7 @@ class fulltext_native extends search_backend
|
||||
}
|
||||
|
||||
// Remove words with no matches ... this is a potentially nasty query
|
||||
$sql = 'SELECT w.word_id
|
||||
$sql = 'SELECT w.word_id, w.word_text
|
||||
FROM ' . SEARCH_WORDLIST_TABLE . ' w
|
||||
LEFT JOIN ' . SEARCH_WORDMATCH_TABLE . ' m ON (w.word_id = m.word_id)
|
||||
WHERE w.word_common = 0 AND m.word_id IS NULL
|
||||
@ -998,14 +997,15 @@ class fulltext_native extends search_backend
|
||||
|
||||
if ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$sql_in = array();
|
||||
$sql_in = $words = array();
|
||||
do
|
||||
{
|
||||
$sql_in[] = $row['word_id'];
|
||||
$words[] = $row['word_text'];
|
||||
}
|
||||
while ($row = $db->sql_fetchrow($result));
|
||||
|
||||
$destroy_cache_words = array_merge($destroy_cache_words, $sql_in);
|
||||
$destroy_cache_words = array_merge($destroy_cache_words, $words);
|
||||
|
||||
$sql = 'DELETE FROM ' . SEARCH_WORDLIST_TABLE . '
|
||||
WHERE word_id IN (' . implode(', ', $sql_in) . ')';
|
||||
|
@ -141,7 +141,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
else if ($auth->acl_getf_global('m_approve'))
|
||||
{
|
||||
$m_approve_fid_ary = array_diff(array_keys($auth->acl_getf('!m_approve', true)), $ex_fid_ary);
|
||||
$m_approve_fid_sql = ' AND (p.post_approved = 1' . (($m_approve_fid_ary) ? ' OR p.forum_id NOT IN (' . implode(', ', $m_approve_fid_ary) . ')') . ')' : '';
|
||||
$m_approve_fid_sql = ' AND (p.post_approved = 1' . (($m_approve_fid_ary) ? ' OR p.forum_id NOT IN (' . implode(', ', $m_approve_fid_ary) . ')' : '') . ')';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -540,6 +540,8 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
$result = $db->sql_query($sql);
|
||||
$result_topic_id = 0;
|
||||
|
||||
$rowset = array();
|
||||
|
||||
if ($show_results == 'topics')
|
||||
{
|
||||
$forums = $rowset = array();
|
||||
|
Loading…
x
Reference in New Issue
Block a user