diff options
Diffstat (limited to 'phpBB/includes/search')
-rw-r--r-- | phpBB/includes/search/base.php | 2 | ||||
-rw-r--r-- | phpBB/includes/search/fulltext_mysql.php | 8 | ||||
-rw-r--r-- | phpBB/includes/search/fulltext_native.php | 15 |
3 files changed, 6 insertions, 19 deletions
diff --git a/phpBB/includes/search/base.php b/phpBB/includes/search/base.php index f691bc942f..b364dead9a 100644 --- a/phpBB/includes/search/base.php +++ b/phpBB/includes/search/base.php @@ -294,7 +294,7 @@ class phpbb_search_base $sql_where = ''; foreach ($authors as $author) { - $sql_where .= (($sql_where) ? ' OR ' : '') . 'search_authors LIKE \'% ' . (int) $author . ' %\''; + $sql_where .= (($sql_where) ? ' OR ' : '') . 'search_authors ' . $db->sql_like_expression($db->any_char . ' ' . (int) $author . ' ' . $db->any_char); } $sql = 'SELECT search_key diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php index 5372cfac7b..7c94038cc9 100644 --- a/phpBB/includes/search/fulltext_mysql.php +++ b/phpBB/includes/search/fulltext_mysql.php @@ -708,7 +708,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base */ function index_remove($post_ids, $author_ids, $forum_ids) { - $this->destroy_cache(array(), $author_ids); + $this->destroy_cache(array(), array_unique($author_ids)); } /** @@ -897,11 +897,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base } $db->sql_freeresult($result); - $sql = 'SELECT COUNT(post_id) as total_posts - FROM ' . POSTS_TABLE; - $result = $db->sql_query($sql); - $this->stats['total_posts'] = (int) $db->sql_fetchfield('total_posts'); - $db->sql_freeresult($result); + $this->stats['total_posts'] = empty($this->stats) ? 0 : $db->get_estimated_row_count(POSTS_TABLE); } /** diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php index b9085695ac..3e029c86d0 100644 --- a/phpBB/includes/search/fulltext_native.php +++ b/phpBB/includes/search/fulltext_native.php @@ -1335,7 +1335,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base $db->sql_query($sql); } - $this->destroy_cache(array_unique($word_texts), $author_ids); + $this->destroy_cache(array_unique($word_texts), array_unique($author_ids)); } /** @@ -1462,17 +1462,8 @@ class phpbb_search_fulltext_native extends phpbb_search_base { global $db; - $sql = 'SELECT COUNT(*) as total_words - FROM ' . SEARCH_WORDLIST_TABLE; - $result = $db->sql_query($sql); - $this->stats['total_words'] = (int) $db->sql_fetchfield('total_words'); - $db->sql_freeresult($result); - - $sql = 'SELECT COUNT(*) as total_matches - FROM ' . SEARCH_WORDMATCH_TABLE; - $result = $db->sql_query($sql); - $this->stats['total_matches'] = (int) $db->sql_fetchfield('total_matches'); - $db->sql_freeresult($result); + $this->stats['total_words'] = $db->get_estimated_row_count(SEARCH_WORDLIST_TABLE); + $this->stats['total_matches'] = $db->get_estimated_row_count(SEARCH_WORDMATCH_TABLE); } /** |