Magento uses index heavily for faster processing and retrieval or records from the database. Most of the time when you update products ideally you were re-indexing your so that Magento indexes the updated records and show them on frontend. Read this interesting post to learn How To Run Magento Indexer From Command Line.
The approach is fine but sometimes when you re-index from Magento admin panel you will notice errors like “An error occurred while saving the URL rewrite” or “cannot initialize indexer process” etc.
There can be numerous factors for such errors i.e.
- php.ini maximum execution time & script input time error
- apache/lighttpd timeout setting issue
- number of products and store views
- lock file from previous time preventing indexing to take place
Getting Rid Of Magento ReIndexing Errors
If even after trying multiple times Magento Indexer fails to respond or keep throwing same errors you can take the following steps resolve Magento ReIndexing errors.
var/locks directory and remove all files under this directory. This will clear all the locks for re-indexing to take place again.
2. Now, login to your MysQSL/phpMyAdmin to run the following MySQL query (Ensure that your have taken full backup before committing this MySQL query)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
DELETE cpop.* FROM catalog_product_option_price AS cpop INNER JOIN catalog_product_option AS cpo ON cpo.option_id = cpop.option_id WHERE cpo.type = 'checkbox' OR cpo.type = 'radio' OR cpo.type = 'drop_down'; DELETE cpotp.* FROM catalog_product_option_type_price AS cpotp INNER JOIN catalog_product_option_type_value AS cpotv ON cpotv.option_type_id = cpotp.option_type_id INNER JOIN catalog_product_option AS cpo ON cpotv.option_id = cpo.option_id WHERE cpo.type <> 'checkbox' AND cpo.type <> 'radio' AND cpo.type <> 'drop_down';
3. Log back in to your
Magento Admin panel and go to System tab > Index Management hit index again and you will notice no such errors will appear again. You can follow these same steps again if re-indexing stops in future to resolve Magento ReIndexing issues.
I would love to hear your experiences and questions about Magento Indexing, ReIndexing and indexing errors. Please leave me a comment and let me know.