mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/9813] Use SHOW TABLE STATUS to get search stats for native on MySQL.
PHPBB3-9813
This commit is contained in:
parent
d67fae0f09
commit
efe25a0b49
1 changed files with 28 additions and 10 deletions
|
@ -1461,6 +1461,22 @@ class fulltext_native extends search_backend
|
|||
{
|
||||
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
|
||||
FROM ' . SEARCH_WORDLIST_TABLE;
|
||||
$result = $db->sql_query($sql);
|
||||
|
@ -1472,6 +1488,8 @@ class fulltext_native extends search_backend
|
|||
$result = $db->sql_query($sql);
|
||||
$this->stats['total_matches'] = (int) $db->sql_fetchfield('total_matches');
|
||||
$db->sql_freeresult($result);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue