Magento index update for one or more specific products
I want to know if there is a way to update the magento index for one or more products. So, for example, I have 100 products that I just programmatically updated the price ... and now I need to kick the indexer so that it recalculates the price for these 100 products. So just to be clear ...
I know you can just update one index for ALL products. For example, this will update the price index for all products:
$process = Mage::getSingleton('index/indexer')->getProcessByCode('catalog_product_price');
$process->reindexEverything();
And I also know that it is possible to update ALL indexes of just one product (or multiple products if you do it in a loop):
Mage::getSingleton('index/indexer')->processEntityAction(
$product, Mage_Catalog_Model_Product::ENTITY,
Mage_Index_Model_Event::TYPE_SAVE
);
BUT, none of these options work for me. I need to be able to make a cross section of these two. How can I take one or more products and update only one index, like a price index?
I am working with Magento CE 1.6.2.0.
EDIT: By the way, on Magento 1.3 I was able to accomplish this by following these steps, but it doesn't work anymore.
Mage::getModel('catalogindex/indexer')->plainReindex(
$listOfProductIds,
Mage_CatalogIndex_Model_Indexer::REINDEX_TYPE_PRICE
);
source to share
Try
Mage::getSingleton('catalogindex/indexer')->plainReindex($productIds);
Mage::getSingleton('catalogindex/aggregation')->clearProductData($productIds);
Another idea:
Mage::getResourceModel('catalog/product_indexer_price')->reindexProductIds($productIds);
This works for me:
$catalogSearchIndexer = Mage::getResourceSingleton('catalogsearch/fulltext');
$catalogSearchIndexer->rebuildIndex($storeId, $productIds);
source to share