2

Can someone please tell me is there any specific order for indexing needs to follow. My current order is,

  1. catalog_product_attribute
  2. catalog_product_price
  3. catalog_url
  4. catalog_product_flat
  5. catalog_category_flat
  6. catalog_category_product
  7. catalogsearch_fulltext
  8. cataloginventory_stock

Why i am asking is since the catalog_url runs as the third and it takes a lot of time to complete. I need to bring up both catalog_product_flat and catalog_category_flat which is required to be upto date for my product import to run correctly.

Thanks :)

2
  • Why don't you just re-index manually? Commented Jun 24, 2013 at 4:04
  • Hi Tim, re-indexing manually not the ideal as this reindexing is a part of daily product import cron followed by a reindexing process. Commented Nov 22, 2013 at 4:07

2 Answers 2

7

The indexing order when reindexing all processes is defined by Mage_Index_Model_Indexer::_runAll().
This method uses the depends property of each process to check which other processes have to run before itself can do it's work.

The getDepends() method of the index/process uses the configuration node global/index/indexer/[process-code]/depends to determine it's dependencies.

Having a look at Mage/Catalog/etc/config.xml, the indexer processes configurations there are as follows:

    <index>
        <indexer>
            <catalog_product_attribute>
                <model>catalog/product_indexer_eav</model>
            </catalog_product_attribute>
            <catalog_product_price>
                <model>catalog/product_indexer_price</model>
            </catalog_product_price>
            <catalog_url>
                <model>catalog/indexer_url</model>
            </catalog_url>
            <catalog_product_flat>
                <model>catalog/product_indexer_flat</model>
            </catalog_product_flat>
            <catalog_category_flat>
                <model>catalog/category_indexer_flat</model>
            </catalog_category_flat>
            <catalog_category_product>
                <model>catalog/category_indexer_product</model>
            </catalog_category_product>
        </indexer>
    </index>

No dependencies are declared at all, so I would say the concrete processing order is more or less random, or unspecified.

To have the *_flat indexer processes run before the catalog_url reindexing, it should be enough to add a dependency as follows:

            <catalog_url>
                <model>catalog/indexer_url</model>
                <depends>
                    <catalog_product_flat/>
                    <catalog_category_flat/>
                </depends>
            </catalog_url>
3
  • Hi Vinai, first of all sorry for taking time to respond. Thanks for the answer and I tried it also it worked well. but later I used indexer.php's commands using exec() in my php class. so I can execute catalog_url indexing at the very end. Commented Nov 22, 2013 at 4:05
  • @Vinai, just a heads up that in order to get the complete global config it's better to use the n98-magerun tool (this command gets you the whole compiled config: magerun config:dump). There you'd have seen that for instance the index catalog_product_attribute does depend on cataloginventory_stock
    – Pitt
    Commented Nov 18, 2016 at 21:08
  • @Pitt In order to effectively use the config dump command first an understanding of what to look for needs to be built. That is the actually important part of the answer. Also keep in mind that third party modules can also influence the indexing order. The merged config can be accessed in many ways, one of them being magerun.
    – Vinai
    Commented Nov 18, 2016 at 21:28
2

One piece of additional information, Vinai's answer shows where some indexes are defined in Mage/Catalog/etc/config.xml, but remember that all config.xml files are combined into one giant xml tree. This means any other config xml can add depends nodes, and some of them do. For example, Mage/CatalogInventory/etc/config.xml adds cataloginventory_stock as a dependent index to catalog_product_price on lines 262-266 (for Community Edition 1.8.1). If you wanted an exhaustive list of dependencies, you would have to load the compiled config.xml and use xpath to find index/indexer and all its children.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.