/**
* 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;
}