aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2009-12-23 19:38:09 +0000
committerNils Adermann <naderman@naderman.de>2009-12-23 19:38:09 +0000
commitdd02aed6e129e9c14bcc5c53ce41973c61bdde9e (patch)
tree3ddfbe9b6a95665e1eef0f5ffe0aa108a66adda9 /phpBB/includes
parent38d0f0f2d9459f67225f65981c7f199801898759 (diff)
downloadforums-dd02aed6e129e9c14bcc5c53ce41973c61bdde9e.tar
forums-dd02aed6e129e9c14bcc5c53ce41973c61bdde9e.tar.gz
forums-dd02aed6e129e9c14bcc5c53ce41973c61bdde9e.tar.bz2
forums-dd02aed6e129e9c14bcc5c53ce41973c61bdde9e.tar.xz
forums-dd02aed6e129e9c14bcc5c53ce41973c61bdde9e.zip
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
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/search/fulltext_native.php21
1 files changed, 13 insertions, 8 deletions
diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php
index 5af3929ccd..e1ab02ba9d 100644
--- a/phpBB/includes/search/fulltext_native.php
+++ b/phpBB/includes/search/fulltext_native.php
@@ -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,