Php 企业版中的Magento重新索引问题
如何在magento ee 1.13.0.2中手动重新编制“库存状态”和“目录产品价格”的索引 事实上我已经试过了Php 企业版中的Magento重新索引问题,php,magento,Php,Magento,如何在magento ee 1.13.0.2中手动重新编制“库存状态”和“目录产品价格”的索引 事实上我已经试过了 $process = Mage::getModel('index/indexer')->getProcessByCode('catalog_product_price'); $process->reindexAll(); 但结果并没有达到我的预期 $process = Mage::getSingleton('index/indexer')->getProcess
$process = Mage::getModel('index/indexer')->getProcessByCode('catalog_product_price');
$process->reindexAll();
但结果并没有达到我的预期
$process = Mage::getSingleton('index/indexer')->getProcessById(2);
$process = Mage::getSingleton('index/indexer')->getProcessByCode('catalog_product_price');
或者尝试$process->reindexEverything()代码>
在magetno 1.13.0.2中,重新索引将通过MySQL触发器自动完成。
仅此而已-为magento设置cronjob
为了测试它,您可以手动运行我几天前偶然发现了这一点。索引在EE中被彻底修改,这就是为什么旧式的重新索引不起作用。您不能再随意重新编制索引,而是可以安排重新编制索引,以便下一个cron作业在后台为您执行:
$client = Mage::getModel('enterprise_mview/client');
$client->init('catalog_product_index_price');
$metadata = $client->getMetadata();
$metadata->setInvalidStatus();
$metadata->save();
关于新索引系统的说明:谢谢Martin,我也尝试过使用此代码,但在EE 1.13.0.2中它不起作用。从技术上讲,如果cron作业能够完成完整的重新索引,则Magento 1 API中的一些代码也可以实现这一点。只是说,您在这里的回答是正确的,在EE中通常不再有完整的重新索引(必要),MySql触发器应该自动处理这个问题(与always cron一起)。也许您可以使用shell命令重新索引?
$client = Mage::getModel('enterprise_mview/client');
$client->init('catalog_product_index_price');
$metadata = $client->getMetadata();
$metadata->setInvalidStatus();
$metadata->save();