Improved search query performance through sorting words by their occurance. [Bug #21555]

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10377 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Nils Adermann 2009-12-23 19:38:09 +00:00
parent 38d0f0f2d9
commit dd02aed6e1
2 changed files with 14 additions and 8 deletions

View file

@ -124,6 +124,7 @@
<li>[Fix] Restrict search for styles/../style.cfg to folders. (Bug #55665)</li>
<li>[Fix] Add ability to disable overall (aka board-wide) feed.</li>
<li>[Fix] Do not pass new_link parameter when creating a persistent connection with mysql. (Bug #55785)</li>
<li>[Fix] Improved search query performance through sorting words by their occurance. (Bug #21555)</li>
<li>[Change] Move redirect into a hidden field to avoid issues with mod_security. (Bug #54145)</li>
<li>[Change] Log activation through inactive users ACP. (Bug #30145)</li>
<li>[Change] Send time of last item instead of current time in ATOM Feeds. (Bug #53305)</li>

View file

@ -202,7 +202,8 @@ class fulltext_native extends search_backend
{
$sql = 'SELECT word_id, word_text, word_common
FROM ' . SEARCH_WORDLIST_TABLE . '
WHERE ' . $db->sql_in_set('word_text', $exact_words);
WHERE ' . $db->sql_in_set('word_text', $exact_words) . '
ORDER BY word_count ASC';
$result = $db->sql_query($sql);
// store an array of words and ids, remove common words
@ -377,10 +378,6 @@ class fulltext_native extends search_backend
return false;
}
sort($this->must_contain_ids);
sort($this->must_not_contain_ids);
sort($this->must_exclude_one_ids);
if (!empty($this->search_query))
{
return true;
@ -420,11 +417,19 @@ class fulltext_native extends search_backend
return false;
}
$must_contain_ids = $this->must_contain_ids;
$must_not_contain_ids = $this->must_not_contain_ids;
$must_exclude_one_ids = $this->must_exclude_one_ids;
sort($must_contain_ids);
sort($must_not_contain_ids);
sort($must_exclude_one_ids);
// generate a search_key from all the options to identify the results
$search_key = md5(implode('#', array(
serialize($this->must_contain_ids),
serialize($this->must_not_contain_ids),
serialize($this->must_exclude_one_ids),
serialize($must_contain_ids),
serialize($must_not_contain_ids),
serialize($must_exclude_one_ids),
$type,
$fields,
$terms,