public function rebuildStoreCategoryIndex($storeId, $categoryIds = null)
{
if ($this->config->isEnabledBackend($storeId) === false) {
$this->logger->log('INDEXING IS DISABLED FOR ' . $this->logger->getStoreName($storeId));
return;
}
$emulationInfo = $this->startEmulation($storeId);
try {
$collection = $this->category_helper->getCategoryCollectionQuery($storeId, $categoryIds);
$size = $collection->getSize();
if ($size > 0) {
$pages = ceil($size / $this->config->getNumberOfElementByPage());
$collection->clear();
$page = 1;
while ($page <= $pages) {
$this->rebuildStoreCategoryIndexPage($storeId, $collection, $page, $this->config->getNumberOfElementByPage(), $emulationInfo);
$page++;
}
unset($indexData);
}
} catch (Exception $e) {
$this->stopEmulation($emulationInfo);
throw $e;
}
$this->stopEmulation($emulationInfo);
}