aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/search
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/search')
-rw-r--r--phpBB/includes/search/fulltext_mysql.php10
-rw-r--r--phpBB/includes/search/fulltext_native.php15
-rw-r--r--phpBB/includes/search/search.php2
3 files changed, 7 insertions, 20 deletions
diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php
index 29cdd8ee9a..bd4c003397 100644
--- a/phpBB/includes/search/fulltext_mysql.php
+++ b/phpBB/includes/search/fulltext_mysql.php
@@ -707,7 +707,7 @@ class fulltext_mysql extends search_backend
*/
function index_remove($post_ids, $author_ids, $forum_ids)
{
- $this->destroy_cache(array(), $author_ids);
+ $this->destroy_cache(array(), array_unique($author_ids));
}
/**
@@ -747,7 +747,7 @@ class fulltext_mysql extends search_backend
{
if ($db->sql_layer == 'mysqli' || version_compare($db->sql_server_info(true), '4.1.3', '>='))
{
- //$alter[] = 'MODIFY post_subject varchar(100) COLLATE utf8_unicode_ci DEFAULT \'\' NOT NULL';
+ $alter[] = 'MODIFY post_subject varchar(255) COLLATE utf8_unicode_ci DEFAULT \'\' NOT NULL';
}
else
{
@@ -896,11 +896,7 @@ class fulltext_mysql extends search_backend
}
$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 727e3aaffb..dc961f3c8a 100644
--- a/phpBB/includes/search/fulltext_native.php
+++ b/phpBB/includes/search/fulltext_native.php
@@ -1334,7 +1334,7 @@ class fulltext_native extends search_backend
$db->sql_query($sql);
}
- $this->destroy_cache(array_unique($word_texts), $author_ids);
+ $this->destroy_cache(array_unique($word_texts), array_unique($author_ids));
}
/**
@@ -1461,17 +1461,8 @@ class fulltext_native extends search_backend
{
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);
}
/**
diff --git a/phpBB/includes/search/search.php b/phpBB/includes/search/search.php
index 2f20d11495..df7c8a0892 100644
--- a/phpBB/includes/search/search.php
+++ b/phpBB/includes/search/search.php
@@ -295,7 +295,7 @@ class search_backend
$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