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

MySQLi Prepare Stmt Error - Rebuilding Search Index

Discussion in 'Troubleshooting and Problems' started by Ghan_04, Mar 6, 2013.

  1. Ghan_04

    Ghan_04 Active Member

    Hey folks,

    It seems that for some reason now, I'm unable to rebuild the search index, and the index itself isn't getting updated properly as posts are made on the board. When I try to rebuild, I'm getting this error:

    Server Error
    Mysqli prepare error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1 INTO xf_search_index (content_type, content_id, title, message, meta' at line 1
    Zend_Db_Statement_Mysqli->_prepare() in Zend/Db/Statement.php at line 115
    Zend_Db_Statement->__construct() in Zend/Db/Adapter/Mysqli.php at line 381
    Zend_Db_Adapter_Mysqli->prepare() in Zend/Db/Adapter/Abstract.php at line 478
    Zend_Db_Adapter_Abstract->query() in XenForo/Search/SourceHandler/MySqlFt.php at line 110
    XenForo_Search_SourceHandler_MySqlFt->_pushToIndex() in XenForo/Search/SourceHandler/MySqlFt.php at line 74
    XenForo_Search_SourceHandler_MySqlFt->insertIntoIndex() in XenForo/Search/Indexer.php at line 44
    XenForo_Search_Indexer->insertIntoIndex() in XenForo/Search/DataHandler/Post.php at line 51
    XenForo_Search_DataHandler_Post->_insertIntoIndex() in XenForo/Search/DataHandler/Abstract.php at line 227
    XenForo_Search_DataHandler_Abstract->insertIntoIndex() in XenForo/Search/DataHandler/Post.php at line 123
    XenForo_Search_DataHandler_Post->quickIndex() in XenForo/Search/DataHandler/Post.php at line 93
    XenForo_Search_DataHandler_Post->rebuildIndex() in XenForo/CacheRebuilder/SearchIndex.php at line 91
    XenForo_CacheRebuilder_SearchIndex->rebuild() in XenForo/ControllerHelper/CacheRebuild.php at line 26
    XenForo_ControllerHelper_CacheRebuild->rebuildCache() in XenForo/ControllerAdmin/Tools.php at line 78
    XenForo_ControllerAdmin_Tools->actionCacheRebuild() in XenForo/FrontController.php at line 312
    XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 132
    XenForo_FrontController->run() in /home/rpdom/public_html/admin.php at line 13
    The only change I know has been made recently is a move from MySQL 5.5 to MySQL 5.6 with InnoDB tables across the board. However, I have converted the xf_search_index table back to MyISAM and it still throws the same error, so it doesn't seem to be engine related. I have also tried disabling all addons and running the rebuild with the same result. Any ideas on this?

  2. digitalpoint

    digitalpoint Well-Known Member

    Try replacing your /library/XenForo/Search/SourceHandler/MySqlFt.php file... my first guess would be it's mucked and not the default file.
    Jake Bunce likes this.
  3. Ghan_04

    Ghan_04 Active Member

    Here is the diff of the stock file and mine:

    <                      REPLACE ' . ($this->_isRebuild ? '' : 'DELAYED') . ' INTO xf_search_index
    >                      REPLACE ' . ($this->_isRebuild OR !XenForo_Application::get('options')->enableInsertDelayed ? '' : 'DELAYED') . ' INTO xf_search_index
    < }
    \ No newline at end of file
    > }
    I changed that line to be able to deal with InnoDB not supporting delayed queries. Would this be causing our current error, though?

    Yeah, it is. Because I'm retarded. Somehow it's evaluating to 1.
  4. Ghan_04

    Ghan_04 Active Member

    Fixed. Just needed to put parens around the entire boolean. PHP syntax is weird sometimes. It was only on rebuild that this was failing. If it were just doing a regular replace (which is what caused the delayed error in the first place) then this didn't seem to have a problem.... At least, I never got any errors to that effect.
    Jake Bunce likes this.

Share This Page