• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

As designed XenForo_Search_SourceHandler_MySqlFt::deleteIndex

Daniel Hood

Well-known member
It's quite possible that this is 'as designed' but I was just wondering why this method doesn't run a delete for the content type. It only does something if you don't specify a content type.

This actually causes:

to ignore the checked box. I think it should be more like:

    * Deletes the entire search index or a particular part of it.
    * @param string|null $contentType If specified, only deletes the index for this type
public function deleteIndex($contentType = null)
        if (!$contentType)
            XenForo_Application::getDb()->query('TRUNCATE TABLE xf_search_index');
            XenForo_Application::getDb()->delete('xf_search_index', 'content_type = ' . $this->_getDb()->quote($contentType));


XenForo developer
Staff member
This is intentional as truncation is fast (it just creates a new table). A delete like that is likely to be very slow if you have a significant amount of data (causing a long lock on the table too).

Daniel Hood

Well-known member
Fair enough. Was just thinking it was odd that the "Delete index" checkbox wasn't doing anything (as I only wanted to empty a small portion of mine). Maybe a note should be placed there for people not using ElasticSearch?