/** * Refresh the custom products position index : just rebuild data from this data provider * * @return Smile_VirtualCategories_Model_Index_Action_VirtualCategories_Product_Position_Refresh * * @throws Enterprise_Index_Model_Action_Exception */ public function execute() { if (!Mage::helper('smile_elasticsearch')->isActiveEngine() == false) { $this->_metadata->setInProgressStatus()->save(); // Let the index process all data $this->_indexer->reindexAll(); if ($this->_metadata->getStatus() == Enterprise_Mview_Model_Metadata::STATUS_IN_PROGRESS) { $this->_metadata->setValidStatus()->save(); } } return $this; }
/** * Execute additional operations before reindex * * @return Enterprise_Catalog_Model_Index_Action_Catalog_Category_Product_Refresh */ protected function _beforeReindex() { $this->_metadata->setInProgressStatus()->save(); /** @var $client Enterprise_Mview_Model_Client */ $client = $this->_factory->getModel('enterprise_mview/client'); $client->init($this->_getPairedIndexerCode())->getMetadata()->setInProgressStatus()->save(); return $this; }
/** * Refresh rows by ids from changelog. * * @return Smile_VirtualCategories_Model_Index_Action_VirtualCategories_Product_Position_Refresh_Changelog * * @throws Enterprise_Index_Model_Action_Exception */ public function execute() { if (!$this->_metadata->isValid()) { throw new Enterprise_Index_Model_Action_Exception("Can't perform operation, incomplete metadata!"); } if (Mage::helper('smile_elasticsearch')->isActiveEngine() == true) { try { if (!empty($this->_changedIds)) { $this->_metadata->setInProgressStatus()->save(); $engine = Mage::helper('catalogsearch')->getEngine(); $mapping = $engine->getCurrentIndex()->getMapping('product'); $dataprovider = $mapping->getDataProvider('virtual_categories_products_position'); $dataprovider->updateAllData(null, $this->_changedIds); $this->_updateMetadata(); } } catch (Exception $e) { $this->_metadata->setInvalidStatus()->save(); throw new Enterprise_Index_Model_Action_Exception($e->getMessage(), $e->getCode()); } } return $this; }
/** * Execute refresh operation. * - clean redirect url rewrites * - refresh redirect url rewrites * - refresh redirect to url rewrite relations * * @return Enterprise_Mview_Model_Action_Interface * @throws Enterprise_Index_Model_Action_Exception */ public function execute() { try { $this->_metadata->setInProgressStatus()->save(); $this->_cleanOldUrlRewrite(); $this->_refreshUrlRewrite(); $this->_refreshRelation(); $this->_setChangelogValid(); } catch (Exception $e) { $this->_metadata->setInvalidStatus()->save(); throw new Enterprise_Index_Model_Action_Exception($e->getMessage(), $e->getCode()); } return $this; }
/** * Run full reindex * * @return Enterprise_CatalogSearch_Model_Index_Action_Fulltext_Refresh * @throws Enterprise_Index_Model_Action_Exception */ public function execute() { if (!$this->_metadata->isValid()) { throw new Enterprise_Index_Model_Action_Exception("Can't perform operation, incomplete metadata!"); } try { $this->_getLastVersionId(); $this->_metadata->setInProgressStatus()->save(); // Reindex all products $this->_indexer->rebuildIndex(); // Clear search results $this->_resetSearchResults(); $this->_updateMetadata(); $this->_app->dispatchEvent('after_reindex_process_catalogsearch_index', array()); } catch (Exception $e) { $this->_metadata->setInvalidStatus()->save(); throw new Enterprise_Index_Model_Action_Exception($e->getMessage(), $e->getCode()); } return $this; }