From 4f282db6e20e1f9d773bdb53ff9794a271584086 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 6 Dec 2020 14:23:18 +0100 Subject: [PATCH] [ticket/16659] Resolve issues with fulltext search in mariadb PHPBB3-16659 --- tests/functional/search/mysql_test.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/functional/search/mysql_test.php b/tests/functional/search/mysql_test.php index a97b12e905..f7e6cbf5f1 100644 --- a/tests/functional/search/mysql_test.php +++ b/tests/functional/search/mysql_test.php @@ -20,4 +20,17 @@ class phpbb_functional_search_mysql_test extends phpbb_functional_search_base { protected $search_backend = '\phpbb\search\fulltext_mysql'; + protected function create_search_index($backend = null) + { + parent::create_search_index($backend); + + // Try optimizing posts table after creating search index. + // Some versions of MariaDB might not return any results in the search + // until the table has been optimized or the index deleted and re-created. + $db = $this->get_db(); + $db->sql_return_on_error(true); + $sql = 'OPTIMIZE TABLE ' . POSTS_TABLE; + $db->sql_query($sql); + $db->sql_return_on_error(false); + } }