Skip to content
Snippets Groups Projects
Commit d2f74f50 authored by Peter Rotich's avatar Peter Rotich
Browse files

Merge pull request #1416 from greezybacon/issue/cluster-search


InnoDB tables for search indexing where possible

Reviewed-By: default avatarPeter Rotich <peter@osticket.com>
parents 50377fe0 65b6264f
No related branches found
No related tags found
No related merge requests found
...@@ -403,14 +403,30 @@ class MysqlSearchBackend extends SearchBackend { ...@@ -403,14 +403,30 @@ class MysqlSearchBackend extends SearchBackend {
} }
static function createSearchTable() { static function createSearchTable() {
$sql = 'CREATE TABLE IF NOT EXISTS '.TABLE_PREFIX.'_search ( // Use InnoDB with Galera, MyISAM with v5.5, and the database
// default otherwise
$sql = "select count(*) from information_schema.tables where
table_schema='information_schema' and table_name =
'INNODB_FT_CONFIG'";
$mysql56 = db_result(db_query($sql));
$sql = "show status like 'wsrep_local_state'";
$galera = db_result(db_query($sql));
if ($galera && !$mysql56)
throw new Exception('Galera cannot be used with MyISAM tables');
$engine = $galera ? 'InnodB' : ($mysql56 ? '' : 'MyISAM');
if ($engine)
$engine = 'ENGINE='.$engine;
$sql = 'CREATE TABLE IF NOT EXISTS '.TABLE_PREFIX."_search (
`object_type` varchar(8) not null, `object_type` varchar(8) not null,
`object_id` int(11) unsigned not null, `object_id` int(11) unsigned not null,
`title` text collate utf8_general_ci, `title` text collate utf8_general_ci,
`content` text collate utf8_general_ci, `content` text collate utf8_general_ci,
primary key `object` (`object_type`, `object_id`), primary key `object` (`object_type`, `object_id`),
fulltext key `search` (`title`, `content`) fulltext key `search` (`title`, `content`)
) ENGINE=MyISAM CHARSET=utf8'; ) $engine CHARSET=utf8";
return db_query($sql); return db_query($sql);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment