Algolia_Algoliasearch_Model_Resource_Engine::rebuildPages PHP Метод

rebuildPages() публичный Метод

public rebuildPages ( )
    public function rebuildPages()
    {
        /** @var Mage_Core_Model_Store $store */
        foreach (Mage::app()->getStores() as $store) {
            if ($this->config->isEnabledBackend($store->getId()) === false) {
                if (php_sapi_name() === 'cli') {
                    echo '[ALGOLIA] INDEXING IS DISABLED FOR ' . $this->logger->getStoreName($store->getId()) . "\n";
                }
                /** @var Mage_Adminhtml_Model_Session $session */
                $session = Mage::getSingleton('adminhtml/session');
                $session->addWarning('[ALGOLIA] INDEXING IS DISABLED FOR ' . $this->logger->getStoreName($store->getId()));
                $this->logger->log('INDEXING IS DISABLED FOR ' . $this->logger->getStoreName($store->getId()));
                continue;
            }
            $this->addToQueue('algoliasearch/observer', 'rebuildPageIndex', array('store_id' => $store->getId()), 1);
        }
    }

Usage Example

 /**
  * Rebuild all index data
  */
 public function reindexAll()
 {
     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;
     }
     $this->engine->rebuildPages();
     return $this;
 }