diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2009-04-18 17:42:31 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2009-04-18 17:42:31 +0000 |
commit | eb49218428ca3cab1776218951608bcf3aa4d944 (patch) | |
tree | 6b7a478f7ee966d189c2c95094e63298b843961f /phpBB/includes/search | |
parent | 7b07476207a7bf5d7fa29909309898dbeb6340f5 (diff) | |
download | forums-eb49218428ca3cab1776218951608bcf3aa4d944.tar forums-eb49218428ca3cab1776218951608bcf3aa4d944.tar.gz forums-eb49218428ca3cab1776218951608bcf3aa4d944.tar.bz2 forums-eb49218428ca3cab1776218951608bcf3aa4d944.tar.xz forums-eb49218428ca3cab1776218951608bcf3aa4d944.zip |
Fix topic title only and first post search option with the SQL_CALC_FOUND_ROWS fix
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9472 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/search')
-rw-r--r-- | phpBB/includes/search/fulltext_native.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php index 9cd54cb27c..fb4975d30b 100644 --- a/phpBB/includes/search/fulltext_native.php +++ b/phpBB/includes/search/fulltext_native.php @@ -650,12 +650,8 @@ class fulltext_native extends search_backend case 'mysql4': case 'mysqli': - $sql_array_copy = $sql_array; - // 3.x does not support SQL_CALC_FOUND_ROWS // $sql_array['SELECT'] = 'SQL_CALC_FOUND_ROWS ' . $sql_array['SELECT']; - $sql_array_copy['SELECT'] = 'SQL_CALC_FOUND_ROWS p.post_id '; - $is_mysql = true; break; @@ -707,7 +703,7 @@ class fulltext_native extends search_backend if ($left_join_topics) { - $sql_array['LEFT_JOIN'][$left_join_topics] = array( + $sql_array['LEFT_JOIN'][] = array( 'FROM' => array(TOPICS_TABLE => 't'), 'ON' => 'p.topic_id = t.topic_id' ); @@ -734,8 +730,12 @@ class fulltext_native extends search_backend } // if we use mysql and the total result count is not cached yet, retrieve it from the db - if (!$total_results && $is_mysql && !empty($sql_array_copy)) + if (!$total_results && $is_mysql) { + // Count rows for the executed queries. Replace $select within $sql with SQL_CALC_FOUND_ROWS, and run it. + $sql_array_copy = $sql_array; + $sql_array_copy['SELECT'] = 'SQL_CALC_FOUND_ROWS p.post_id '; + $sql = $db->sql_build_query('SELECT', $sql_array_copy); unset($sql_array_copy); |