From 3d27ed13f5ac960fc24a3f95e39c767be4a48f31 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sat, 29 Dec 2012 19:34:21 -0500 Subject: [PATCH] [ticket/11188] Reduce waste. PHPBB3-11188 --- phpBB/includes/search/fulltext_postgres.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/search/fulltext_postgres.php b/phpBB/includes/search/fulltext_postgres.php index 7d7b3f6fa8..1475cc31d0 100644 --- a/phpBB/includes/search/fulltext_postgres.php +++ b/phpBB/includes/search/fulltext_postgres.php @@ -477,10 +477,13 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base } $this->db->sql_transaction('begin'); + + $sql_from = "FROM $sql_from$sql_sort_table" . POSTS_TABLE . " p"; + $sql_where = "WHERE (" . implode(' OR ', $tmp_sql_match) . ") + $sql_where_options"; $sql = "SELECT $sql_select - FROM $sql_from$sql_sort_table" . POSTS_TABLE . " p - WHERE (" . implode(' OR ', $tmp_sql_match) . ") - $sql_where_options + $sql_from + $sql_where ORDER BY $sql_sort"; $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start); @@ -501,9 +504,8 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base if (!$result_count) { $sql_count = "SELECT COUNT(*) as result_count - FROM $sql_from$sql_sort_table" . POSTS_TABLE . " p - WHERE (" . implode(' OR ', $tmp_sql_match) . ") - $sql_where_options"; + $sql_from + $sql_where"; $result = $this->db->sql_query($sql_count); $result_count = (int) $this->db->sql_fetchfield('result_count'); $this->db->sql_freeresult($result);