Magento: SOLR indexation loops twice through product catalog

Our recent experience with SOLR setup with Magento EE put us through some interesting challenges and we hope that our experience sharing here helps those out there facing similar issues and saves valuable developer time We would welcome any suggestions on how to handle the issue below more elegantly if possible.

On the face of it, the problem seemed to be too much time being taken by indexation. On further investigation, we found out that SOLR indexation looped twice through product catalog.

This instance of Magento EE has one website, two stores and each has its own storeview. It also uses uRapidFlow extension for importing products. uRapidFlow by default assigns imported products to all active stores views (if any store view is selected then this store view receives imported products).

During indexation (catalogsearch_fulltext) Magento pushes products associated with all the active storeviews in the system. Since we have two active storeviews, indexation took in 2 loops.

How to stop indexation from looping:

When importing products using uRapidFlow don’t forget to select specific store view to which the products are being assigned to. If you accidentally already have products assigned to multiple store views:

remove unused stores / store views (as a result all relations to assigned products will be removed too)