aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2017-12-22 19:45:16 +0100
committerMarc Alexander <admin@m-a-styles.de>2017-12-22 19:45:16 +0100
commite2e47a87c3a4517a02e3a10c0292effaa7f56179 (patch)
tree2c1c708d5548f645bda3ea47516cb5118990f6c5 /phpBB/phpbb
parente23b671d322e329d7c4e1ab80bc7d6e37d130d54 (diff)
parentf9b9d659a1638389e6250110ce54d18e9d9bd59c (diff)
downloadforums-e2e47a87c3a4517a02e3a10c0292effaa7f56179.tar
forums-e2e47a87c3a4517a02e3a10c0292effaa7f56179.tar.gz
forums-e2e47a87c3a4517a02e3a10c0292effaa7f56179.tar.bz2
forums-e2e47a87c3a4517a02e3a10c0292effaa7f56179.tar.xz
forums-e2e47a87c3a4517a02e3a10c0292effaa7f56179.zip
Merge pull request #5032 from rxu/ticket/15224
[ticket/15224] Fix some MySQL fulltext index searching errors
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r--phpBB/phpbb/search/fulltext_mysql.php19
1 files changed, 17 insertions, 2 deletions
diff --git a/phpBB/phpbb/search/fulltext_mysql.php b/phpBB/phpbb/search/fulltext_mysql.php
index da1aad1c3a..c8df1951e3 100644
--- a/phpBB/phpbb/search/fulltext_mysql.php
+++ b/phpBB/phpbb/search/fulltext_mysql.php
@@ -591,6 +591,7 @@ class fulltext_mysql extends \phpbb\search\base
WHERE MATCH ($sql_match) AGAINST ('" . $this->db->sql_escape(htmlspecialchars_decode($this->search_query)) . "' IN BOOLEAN MODE)
$sql_where_options
ORDER BY $sql_sort";
+ $this->db->sql_return_on_error(true);
$result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start);
while ($row = $this->db->sql_fetchrow($result))
@@ -602,7 +603,7 @@ class fulltext_mysql extends \phpbb\search\base
$id_ary = array_unique($id_ary);
// if the total result count is not cached yet, retrieve it from the db
- if (!$result_count)
+ if (!$result_count && count($id_ary))
{
$sql_found_rows = 'SELECT FOUND_ROWS() as result_count';
$result = $this->db->sql_query($sql_found_rows);
@@ -1004,6 +1005,11 @@ class fulltext_mysql extends \phpbb\search\base
}
}
+ if (!isset($this->stats['post_text']))
+ {
+ $this->db->sql_query('ALTER TABLE ' . POSTS_TABLE . ' ADD FULLTEXT post_text (post_text)');
+ }
+
$this->db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE);
return false;
@@ -1039,6 +1045,11 @@ class fulltext_mysql extends \phpbb\search\base
$alter[] = 'DROP INDEX post_content';
}
+ if (isset($this->stats['post_text']))
+ {
+ $alter[] = 'DROP INDEX post_text';
+ }
+
if (sizeof($alter))
{
$this->db->sql_query('ALTER TABLE ' . POSTS_TABLE . ' ' . implode(', ', $alter));
@@ -1059,7 +1070,7 @@ class fulltext_mysql extends \phpbb\search\base
$this->get_stats();
}
- return isset($this->stats['post_subject']) && isset($this->stats['post_content']);
+ return isset($this->stats['post_subject']) && isset($this->stats['post_content']) && isset($this->stats['post_text']);
}
/**
@@ -1103,6 +1114,10 @@ class fulltext_mysql extends \phpbb\search\base
{
$this->stats['post_subject'] = $row;
}
+ else if ($row['Key_name'] == 'post_text')
+ {
+ $this->stats['post_text'] = $row;
+ }
else if ($row['Key_name'] == 'post_content')
{
$this->stats['post_content'] = $row;