1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/16976] Fix search results count for in-topic/in-forum search

PHPBB3-16976
This commit is contained in:
rxu
2022-03-27 12:33:14 +07:00
parent 16b27be2d0
commit 6cc0fe5f95
2 changed files with 30 additions and 2 deletions

View File

@@ -984,9 +984,9 @@ class fulltext_native extends \phpbb\search\base
// If using mysql and the total result count is not calculated yet, get it from the db
if (!$total_results && $is_mysql)
{
$sql_count = str_replace("SELECT {$sql_array['SELECT']}", "SELECT COUNT({$sql_array['SELECT']})", $sql);
$sql_count = str_replace("SELECT {$sql_array['SELECT']}", "SELECT COUNT({$sql_array['SELECT']}) as total_results", $sql);
$result = $this->db->sql_query($sql_count);
$total_results = count($this->db->sql_fetchrowset($result));
$total_results = $sql_array['GROUP_BY'] ? count($this->db->sql_fetchrowset($result)) : $this->db->sql_fetchfield('total_results');
$this->db->sql_freeresult($result);
if (!$total_results)