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

Merge pull request #2250 from greezybacon/issue/2208


search: Auto reindex when _search is created

Reviewed-By: default avatarPeter Rotich <peter@osticket.com>
parents 54b53b9e 86c7f1b9
No related branches found
No related tags found
No related merge requests found
......@@ -454,7 +454,7 @@ class MysqlSearchBackend extends SearchBackend {
$galera = db_result(db_query($sql));
if ($galera && !$mysql56)
throw new Exception('Galera cannot be used with MyISAM tables');
throw new Exception('Galera cannot be used with MyISAM tables. Upgrade to MariaDB 10 / MySQL 5.6 is required');
$engine = $galera ? 'InnodB' : ($mysql56 ? '' : 'MyISAM');
if ($engine)
$engine = 'ENGINE='.$engine;
......@@ -467,12 +467,17 @@ class MysqlSearchBackend extends SearchBackend {
primary key `object` (`object_type`, `object_id`),
fulltext key `search` (`title`, `content`)
) $engine CHARSET=utf8";
return db_query($sql);
if (!db_query($sql))
return false;
// Start rebuilding the index
$this->getConfig()->set('reindex', 1);
return true;
}
/**
* Cooperates with the cron system to automatically find content that is
* not index in the _search table and add it to the index.
* not indexed in the _search table and add it to the index.
*/
function IndexOldStuff() {
$class = get_class();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment