/** * Overloaded method rebuildIndex. * Regenerate search index for store(s) * * @param int|null $storeId * @param int|array|null $productIds * @return Magentix_Solr_Model_CatalogSearch_Resource_Fulltext */ public function rebuildIndex($storeId = null, $productIds = null) { parent::rebuildIndex($storeId, $productIds); if (Mage::getStoreConfigFlag('solr/active/admin')) { Mage::getModel('solr/indexer')->rebuildIndex($productIds); } return $this; }
/** * Only used when reindexing everything. Otherwise Model/Indexer/Algolia will take care of the rest. */ public function rebuildIndex($storeId = null, $productIds = null) { if ($this->config->isEnabledBackend(Mage::app()->getStore()->getId()) === false) { return parent::rebuildIndex($storeId, $productIds); } if (!$this->config->getApplicationID() || !$this->config->getAPIKey() || !$this->config->getSearchOnlyAPIKey()) { /** @var Mage_Adminhtml_Model_Session $session */ $session = Mage::getSingleton('adminhtml/session'); $session->addError('Algolia reindexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.'); return null; } /* Avoid Indexing twice */ if (is_array($productIds) && $productIds > 0) { return $this; } $this->engine->rebuildProducts($storeId); return $this; }
/** * Only used when reindexing everything. Otherwise Model/Indexer/Algolia will take care of the rest */ public function rebuildIndex($storeId = null, $productIds = null) { if ($this->config->isEnabledBackEnd(Mage::app()->getStore()->getId()) === false) { return parent::rebuildIndex($storeId, $productIds); } if (!$this->config->getApplicationID() || !$this->config->getAPIKey() || !$this->config->getSearchOnlyAPIKey()) { Mage::getSingleton('adminhtml/session')->addError('Algolia reindexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.'); return; } /** Avoid Indexing twice */ if (is_array($productIds) && $productIds > 0) { return $this; } if ($storeId == null) { foreach (Mage::app()->getStores() as $id => $store) { $this->engine->rebuildProductIndex($id, null); } } else { $this->engine->rebuildProductIndex($storeId, null); } return $this; }