mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-06 07:35:29 +02:00
[Change] Performance improvements for native fulltext search (patch by Paul)
(This has been tested for 2 weeks in a live environment) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9440 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
77fcc367e2
commit
0319733ea8
@ -137,15 +137,16 @@
|
||||
<li>[Fix] Enforce correct case for template variables</li>
|
||||
<li>[Fix] Set topic_last_view_time on post/reply/edit to circumvent race conditions in auto prune and false removal of topics for manual forum prune (Bug #18055, #43515)</li>
|
||||
<li>[Fix] Correctly split long subject lines according to the used RFC. This fixes extra spaces within long subjects. (Bug #43715)</li>
|
||||
<li>[Change] Allow download of conflicting file for later reference in automatic updater</li>
|
||||
<li>[Change] Default difference view is now 'inline' instead of 'side by side'</li>
|
||||
<li>[Change] Added new option for merging differences to conflicting files in automatic updater</li>
|
||||
<li>[Change] Added new options for visual confirmation.</li>
|
||||
<li>[Change] Add link to user profile in the MCP for user notes and warn user.</li>
|
||||
<li>[Change] Add IN_PHPBB check to generated cache files. (reported by bantu)</li>
|
||||
<li>[Change] Add topic icons to prosilver UCP main and subscribed templates (Bug #42735 - Patch by Raimon)</li>
|
||||
<li>[Change] Add unique key to ACL options table to prevent duplicate permission options. (Bug #41835)</li>
|
||||
<li>[Change] Redirect to relevant MCP page of multi-page topic if accessing quickmod tools (Split option for example)</li>
|
||||
<li>[Change] Performance improvements for native fulltext search (patch by Paul)</li>
|
||||
<li>[Feature] Added new options for visual confirmation.</li>
|
||||
<li>[Feature] Allow download of conflicting file for later reference in automatic updater</li>
|
||||
<li>[Feature] Allow translation of custom BBCode help messages. (Patch by bantu)</li>
|
||||
<li>[Feature] db_tools now support create table and drop table.</li>
|
||||
<li>[Feature] Database updater checks for incompatible db schema (MySQL 3.x/4.x against MySQL 4.1.x/5.x/6.x)</li>
|
||||
|
@ -650,8 +650,12 @@ 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['SELECT'] = 'SQL_CALC_FOUND_ROWS ' . $sql_array['SELECT'];
|
||||
$sql_array_copy['SELECT'] = 'SQL_CALC_FOUND_ROWS p.post_id ';
|
||||
|
||||
$is_mysql = true;
|
||||
|
||||
break;
|
||||
@ -730,8 +734,14 @@ 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)
|
||||
if (!$total_results && $is_mysql && !empty($sql_array_copy))
|
||||
{
|
||||
$sql = $db->sql_build_query('SELECT', $sql_array_copy);
|
||||
unset($sql_array_copy);
|
||||
|
||||
$db->sql_query($sql);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sql = 'SELECT FOUND_ROWS() as total_results';
|
||||
$result = $db->sql_query($sql);
|
||||
$total_results = (int) $db->sql_fetchfield('total_results');
|
||||
@ -855,7 +865,7 @@ class fulltext_native extends search_backend
|
||||
{
|
||||
case 'mysql4':
|
||||
case 'mysqli':
|
||||
$select = 'SQL_CALC_FOUND_ROWS ' . $select;
|
||||
// $select = 'SQL_CALC_FOUND_ROWS ' . $select;
|
||||
$is_mysql = true;
|
||||
break;
|
||||
|
||||
@ -948,6 +958,12 @@ class fulltext_native extends search_backend
|
||||
|
||||
if (!$total_results && $is_mysql)
|
||||
{
|
||||
// Count rows for the executed queries. Replace $select within $sql with SQL_CALC_FOUND_ROWS, and run it.
|
||||
$sql = str_replace('SELECT ' . $select, 'SELECT DISTINCT SQL_CALC_FOUND_ROWS p.post_id', $sql);
|
||||
|
||||
$db->sql_query($sql);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sql = 'SELECT FOUND_ROWS() as total_results';
|
||||
$result = $db->sql_query($sql);
|
||||
$total_results = (int) $db->sql_fetchfield('total_results');
|
||||
|
Loading…
x
Reference in New Issue
Block a user