/** * @param ShopIndex $index * @param ProgressHelperInterface $progress */ public function populate(ShopIndex $index, ProgressHelperInterface $progress) { $query = $this->queryFactory->createQuery(); $progress->start($query->fetchCount(), 'Indexing properties'); while ($ids = $query->fetch()) { $this->indexProperties($index, $ids); $progress->advance(count($ids)); } $progress->finish(); }
/** * @param ShopIndex $index * @param ProgressHelperInterface $progress */ public function populate(ShopIndex $index, ProgressHelperInterface $progress) { $ids = $this->getBlogIds($index->getShop()); $progress->start(count($ids), 'Indexing blog'); $chunks = array_chunk($ids, 100); foreach ($chunks as $chunk) { $this->index($index, $chunk); $progress->advance(100); } $progress->finish(); }
/** * @param ShopIndex $index * @param ProgressHelperInterface $progress */ public function populate(ShopIndex $index, ProgressHelperInterface $progress) { $categoryId = $index->getShop()->getCategory()->getId(); $idQuery = $this->queryFactory->createCategoryQuery($categoryId, 100); $progress->start($idQuery->fetchCount(), 'Indexing products'); while ($ids = $idQuery->fetch()) { $query = $this->queryFactory->createProductIdQuery($ids); $this->indexProducts($index, $query->fetch()); $progress->advance(count(array_unique($ids))); } $progress->finish(); }