Difference Between Event and Process in Creating Custom Index in Magento

indexindexing

Can someone please explain difference between Process and Events when creating a Custom Index in Magento?

When are the functions _processEvent(Mage_Index_Model_Event $event), _registerEvent(Mage_Index_Model_Event $event), and matchEvent(Mage_Index_Model_Event $event) are called and how to use them? thanks

Best Answer

Index Event

This is the moment when the entity is changed. So if a product is updated then it will get a row in the event table index_event. It has the following information:

  1. The old data,
  2. The new data,
  3. Event type,
  4. Entity,
  5. The id of the entity,
  6. The date time that the event was saved

Event Types

There are also the following event types:

  1. Save - when entity is saved,
  2. Delete - when entity is deleted,
  3. Mass Update - when a batch of entities was updated,

Index Process

This is basically a wrapper for the indexer itself and can be found in the table index_process. It has the following information:

  1. Indexer code,
  2. Current indexer status,
  3. Start and end times,
  4. And the mode.

Indexer Process Statuses

  1. Pending - indexer is up to date,
  2. Running - currently being processed,
  3. Require reindex - something has changed in the entity and the index need to be rerun,

If the index mode is set to "real-time" then when an entity is changed then the process will be rerun straight away, but when the index mode is set to "manual" then on update the process status will be set to "Require reindex"

Note: super article on this http://www.slideshare.net/ivanchepurnyi/magento-indexes

Related Topic