Backend\Modules\Search\Installer\Installer::searchPages PHP 메소드

searchPages() 개인적인 메소드

Activate search on pages
private searchPages ( )
    private function searchPages()
    {
        // make 'pages' searchable
        $this->makeSearchable('Pages');
        // get db instance
        $db = $this->getDB();
        // get existing menu items
        $menu = $db->getRecords('SELECT id, revision_id, language, title
             FROM pages
             WHERE status = ?', array('active'));
        // loop menu items
        foreach ($menu as $page) {
            // get blocks
            $blocks = $db->getColumn('SELECT html FROM pages_blocks WHERE revision_id = ?', array($page['revision_id']));
            // merge blocks content
            $text = strip_tags(implode(' ', $blocks));
            // add page to search index
            $db->execute('INSERT INTO search_index (module, other_id, language, field, value, active)
                 VALUES (?, ?, ?, ?, ?, ?)
                 ON DUPLICATE KEY UPDATE value = ?, active = ?', array('Pages', (int) $page['id'], (string) $page['language'], 'title', $page['title'], 'Y', $page['title'], 'Y'));
            $db->execute('INSERT INTO search_index (module, other_id, language, field, value, active)
                 VALUES (?, ?, ?, ?, ?, ?)
                 ON DUPLICATE KEY UPDATE value = ?, active = ?', array('Pages', (int) $page['id'], (string) $page['language'], 'text', $text, 'Y', $text, 'Y'));
        }
    }