diff --git a/phpBB/phpbb/search/backend/fulltext_postgres.php b/phpBB/phpbb/search/backend/fulltext_postgres.php index d9a7c366da..20164cac9d 100644 --- a/phpBB/phpbb/search/backend/fulltext_postgres.php +++ b/phpBB/phpbb/search/backend/fulltext_postgres.php @@ -482,7 +482,7 @@ class fulltext_postgres extends base implements search_backend_interface // if the total result count is not cached yet, retrieve it from the db if (!$result_count) { - $sql_count = "SELECT COUNT(*) as result_count + $sql_count = "SELECT COUNT(DISTINCT " . (($type == 'posts') ? 'p.post_id' : 't.topic_id') . ") as result_count $sql_from $sql_where"; $result = $this->db->sql_query($sql_count);