1. 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

Discussion in 'Resolved Bug Reports' started by Daniel Hood, Apr 13, 2015.

  1. Daniel Hood

    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:

    upload_2015-4-13_13-29-55.png
    to ignore the checked box. I think it should be more like:

    PHP:
    /**
        * 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');
            }
            else
            {
                
    XenForo_Application::getDb()->delete('xf_search_index''content_type = ' $this->_getDb()->quote($contentType));
            }
        }
     
  2. Mike

    Mike 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).
     
  3. Daniel Hood

    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?
     

Share This Page