Contao\Automator::purgeSearchTables PHP Method

purgeSearchTables() public method

Purge the search tables
public purgeSearchTables ( )
    public function purgeSearchTables()
    {
        $objDatabase = \Database::getInstance();
        // Truncate the tables
        $objDatabase->execute("TRUNCATE TABLE tl_search");
        $objDatabase->execute("TRUNCATE TABLE tl_search_index");
        $strCachePath = str_replace(TL_ROOT . DIRECTORY_SEPARATOR, '', \System::getContainer()->getParameter('kernel.cache_dir'));
        // Purge the cache folder
        $objFolder = new \Folder($strCachePath . '/contao/search');
        $objFolder->purge();
        // Add a log entry
        $this->log('Purged the search tables', __METHOD__, TL_CRON);
    }