From time to time, you might find the need to re-index Magento via the command line. This could be for a whole host of reasons, for example, if the indexer is timing out or not finishing through the web interface.
Magento includes an indexing script and you can find it in the shell folder.
From here, you have a number of commands at your disposal.
Checking for the status of all indexes
Re-indexing a single index
php indexer.php --status
Each index has its own index key that you can use to reference it when asking Magento to re-index. To get these keys, you can use the following command:
To reindex a single index, run the following command.
php indexer.php --info
This can be comma delimited for multiple indices:
php indexer.php --reindex [Index Option Code]
The following code will loop through each index and re-index it.
php indexer.php --reindex catalog_product_price,catalog_url,catalog_product_flat
Re-index all indices
php indexer.php --reindexall
View more threads in the same category: