I ran into this problem in CE v1.9.0.1. My admin module received all processes as a collection and iterated over all calls to reindexEverything (). I based the code on the adminhtml process controller, which worked fine, but my code didn't work at all.
It finally turned out that I had previously set the reindex mode to manual (in order to speed up my product import procedure) as follows:
$processes = Mage::getSingleton('index/indexer')->getProcessesCollection(); $processes->walk('setMode', array(Mage_Index_Model_Process::MODE_MANUAL)); // run product import $processes = Mage::getSingleton('index/indexer')->getProcessesCollection(); foreach($processes as $p) { if($p->getIndexer()->isVisible()) { $p->reindexEverything(); //echo $p->getIndexer()->getName() . ' reindexed<br>'; } } $processes = Mage::getSingleton('index/indexer')->getProcessesCollection(); $processes->walk('setMode', array(Mage_Index_Model_Process::MODE_REAL_TIME));
SOLUTION: set the mode back to MODE_REAL_TIME before reindexing everything:
$processes = Mage::getSingleton('index/indexer')->getProcessesCollection(); $processes->walk('setMode', array(Mage_Index_Model_Process::MODE_MANUAL)); // run product import $processes = Mage::getSingleton('index/indexer')->getProcessesCollection(); $processes->walk('setMode', array(Mage_Index_Model_Process::MODE_REAL_TIME)); $processes = Mage::getSingleton('index/indexer')->getProcessesCollection(); foreach($processes as $p) { if($p->getIndexer()->isVisible()) { $p->reindexEverything(); //echo $p->getIndexer()->getName() . ' reindexed<br>'; } }
Note: these are fragments from several different methods, therefore, re-assignment of $ processes, etc.
It seemed that reindexEverything () was not doing anything when the process index mode was set to MODE_MANUAL. The setup mode will return to MODE_REAL_TIME, and then the call to reindexEverything worked fine.
Hope this helps someone since I had a few disappointing hours when we found out!
thanks
source share