【问题标题】:Magento Catalog Search Index, Cannot initialize the indexer processMagento 目录搜索索引,无法初始化索引器进程
【发布时间】:2014-01-16 02:34:26
【问题描述】:

我在这里需要一些帮助,Magento 1.7.0.1 抛出错误“无法初始化索引器进程。”当我们尝试重新索引目录搜索索引时。所有其他索引都运行良好。

2013-11-28T21:32:38+00:00 DEBUG (7): Exception message: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'e.category_ids' in 'field list'
Trace: #0 /path_to_root/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /path_to_root/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /path_to_root/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /path_to_root/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT STRAIGHT...', Array)
#4 /path_to_root/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('SELECT STRAIGHT...', Array)
#5 /path_to_root/lib/Zend/Db/Adapter/Abstract.php(734): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select), Array)
#6 /path_to_root/app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php(265): Zend_Db_Adapter_Abstract->fetchAll(Object(Varien_Db_Select))
#7 /path_to_root/app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php(157): Mage_CatalogSearch_Model_Resource_Fulltext->_getSearchableProducts(1, Array, NULL, 0)
#8 /path_to_root/app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php(116): Mage_CatalogSearch_Model_Resource_Fulltext->_rebuildStoreIndex(1, NULL)
#9 /path_to_root/app/code/core/Mage/CatalogSearch/Model/Fulltext.php(84): Mage_CatalogSearch_Model_Resource_Fulltext->rebuildIndex(NULL, NULL)
#10 /path_to_root/app/code/core/Mage/CatalogSearch/Model/Indexer/Fulltext.php(446): Mage_CatalogSearch_Model_Fulltext->rebuildIndex()
#11 /path_to_root/app/code/core/Mage/Index/Model/Process.php(209): Mage_CatalogSearch_Model_Indexer_Fulltext->reindexAll()
#12 /path_to_root/app/code/core/Mage/Index/Model/Process.php(255): Mage_Index_Model_Process->reindexAll()
#13 /path_to_root/app/code/core/Mage/Index/controllers/Adminhtml/ProcessController.php(178): Mage_Index_Model_Process->reindexEverything()
#14 /path_to_root/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Index_Adminhtml_ProcessController->massReindexAction()
#15 /path_to_root/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('massReindex')
#16 /path_to_root/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#17 /path_to_root/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#18 /path_to_root/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#19 /path_to_root/index.php(87): Mage::run('', 'store')
#20 {main}

我们已尝试使用数据库修复工具并禁用所有扩展,但没有得到任何响应。

我很确定它正在某处的表中寻找 e.category_ids 但不知道是哪个。

这里的任何帮助都会很热!

【问题讨论】:

    标签: php mysql magento indexing magento-1.7


    【解决方案1】:

    PHP/Magento 已经为您提供了自己调试所需的所有信息。具体来说,调用堆栈中的第 7 行——紧接在调用 fetchAll 之前的那一行

    #7 /path_to_root/app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php(157): 
    Mage_CatalogSearch_Model_Resource_Fulltext->_getSearchableProducts(1, Array, NULL, 0)
    

    看来_getSearchableProducts 构建的查询是你的罪魁祸首。在标准 Magento 系统中,此查询如下所示

    SELECT STRAIGHT_JOIN `e`.`entity_id`, `e`.`type_id`, `e`.`sku`, `stock_status`.`stock_status` AS `in_stock` 
    FROM `catalog_product_entity` AS `e`
    INNER JOIN `catalog_product_website` AS `website` 
        ON website.product_id=e.entity_id AND website.website_id='1'
    INNER JOIN `cataloginventory_stock_status` AS `stock_status` 
        ON stock_status.product_id=e.entity_id AND stock_status.website_id='1' 
    WHERE (e.entity_id>0) ORDER BY `e`.`entity_id` ASC LIMIT 100
    

    也就是说,没有提到category_ids 字段。这意味着您的特定系统(核心 hack、侦听器、重写等)中的某个地方存在自定义代码,该代码向此查询添加了额外的 WHEREON 子句。

    你可以在你自己的系统中调试这个,暂时在你的系统中添加以下调试

    #File: app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php
    protected function _getSearchableProducts($storeId, array $staticFields, $productIds = null, $lastProductId = 0,
        $limit = 100)
    {
        //...
        echo (string) $select;
        exit;
        $result = $writeAdapter->fetchAll($select);        
    }
    

    这将输出您的系统生成的 SQL 查询,您可以从那里回溯。

    【讨论】:

    • 这不一定是代码问题,也可能是数据库配置错误。
    【解决方案2】:

    当您在 eav_attribute 中将任何属性设置为“static”作为 backend_type(category_ids 是其中之一)并且相同的 attributeID(category_ids 为 108)在 catalog_eav_attribute 中将“is_searchable”设置为 true 时,您会收到此错误。

    catalog_product_entity 表中必须存在唯一可以是“静态”和“is_searchable”的属性(例如 sku)。

    我无法告诉您如何在 catalog_eav_attribute 中为 attribute_id 108 将“is_searchable”设置为“1”,但将其设置为“0”应该可以解决此错误。

    【讨论】:

      【解决方案3】:

      这可能有点棘手,但我已经解决了这个问题,只需在表中添加一个空白列 catalog_product_entity 作为一个整数,标题为 category_ids 我很确定这最初是由安装“高级”引起的自定义产品选项插件,虽然我不确定更多细节。

      感谢 Alan,这对实现这一目标有很大帮助! :D

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-04-19
        相关资源
        最近更新 更多