а помогло

Это еще цветочки ...База уже 12Mb.
Код: Выделить всё
DELETE FROM phpbb_search_wordmatch,phpbb_search_wordlist
USING phpbb_search_wordmatch,phpbb_search_wordlist
WHERE phpbb_search_wordmatch.word_id = phpbb_search_wordlist.word_id
AND ( length(phpbb_search_wordlist.word_text) < 3
OR length(phpbb_search_wordlist.word_text) > 20);
Код: Выделить всё
SELECT ls.word_id, ls.word_text, COUNT(wm.word_id) as entries FROM `phpbb_search_wordlist` as ls LEFT JOIN `phpbb_search_wordmatch` as wm ON ls.word_id=wm.word_id GROUP BY wm.word_id ORDER BY entries DESC LIMIT 0,50
Код: Выделить всё
<?php
//***** reduce_my_searchtables_with_stopwords.php ****//
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/functions_search.'.$phpEx);
// Start session management
$userdata = session_pagestart($user_ip, PAGE_SEARCH);
init_userprefs($userdata);
// End session management
$stopwords_array = file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . "/search_stopwords.txt");
$liste='';
foreach($stopwords_array as $curr_word)
{
$liste .= ( ( $liste != '' ) ? ', ' : '' ) ."'".trim($curr_word)."'";
}
$sql = "SELECT word_id
FROM " . SEARCH_WORD_TABLE . "
WHERE word_text IN ($liste)";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain common word list', '', __LINE__, __FILE__, $sql);
}
$common_word_id = '';
while ( $row = $db->sql_fetchrow($result) )
{
$common_word_id .= ( ( $common_word_id != '' ) ? ', ' : '' ) . $row['word_id'];
}
if ($common_word_id=='') message_die(GENERAL_ERROR,'None of the words in the list are in your search_tables.<br>Note: This could also mean the list is empty ;)');
//echo '>'.trim($curr_word)."<<br>";
//echo $liste .'<br>'. $common_word_id;
//exit;
$sql = "DELETE FROM " . SEARCH_WORD_TABLE . "
WHERE word_id IN ($common_word_id)";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete word match entry', '', __LINE__, __FILE__, $sql);
}
$sql = "OPTIMIZE TABLE " . SEARCH_WORD_TABLE;
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not optimize', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "
WHERE word_id IN ($common_word_id)";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete word match entry', '', __LINE__, __FILE__, $sql);
}
$sql = "OPTIMIZE TABLE " . SEARCH_MATCH_TABLE;
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not pütimize', '', __LINE__, __FILE__, $sql);
}
message_die(GENERAL_MESSAGE,'<b>Done!</b><br><br>The following list-entries have been removed from your searchtables:'.$liste);
//echo $liste .'<br>'. $common_word_id;
?>
Угу. Если только ты не боишься, что тебя через эту таблицу заDDOS-ят ...Пусть уж лучше будет таблица поисковых слов размером в 700МБ - это не так страшно
Код: Выделить всё
add_search_words ...
Код: Выделить всё
if (($forum_id != 1) and ($forum_id != 20))
{
add_search_words ...
}