mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-20 00:21:42 +02:00
[ticket/9813] Use SHOW TABLE STATUS to get search stats for native on MySQL.
PHPBB3-9813
This commit is contained in:
@@ -1461,6 +1461,22 @@ class fulltext_native extends search_backend
|
|||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
|
switch ($db->sql_layer)
|
||||||
|
{
|
||||||
|
case 'mysql4':
|
||||||
|
case 'mysqli':
|
||||||
|
$sql = "SHOW TABLE STATUS LIKE '" . SEARCH_WORDLIST_TABLE . "'";
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
$this->stats['total_words'] = (int) $db->sql_fetchfield('Rows');
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
$sql = "SHOW TABLE STATUS LIKE '" . SEARCH_WORDMATCH_TABLE . "'";
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
$this->stats['total_matches'] = (int) $db->sql_fetchfield('Rows');
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
$sql = 'SELECT COUNT(*) as total_words
|
$sql = 'SELECT COUNT(*) as total_words
|
||||||
FROM ' . SEARCH_WORDLIST_TABLE;
|
FROM ' . SEARCH_WORDLIST_TABLE;
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
@@ -1472,6 +1488,8 @@ class fulltext_native extends search_backend
|
|||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$this->stats['total_matches'] = (int) $db->sql_fetchfield('total_matches');
|
$this->stats['total_matches'] = (int) $db->sql_fetchfield('total_matches');
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user