indexProducts example

$this->queryFactory = $queryFactory;
    }

    /** * {@inheritdoc} */
    public function synchronize(ShopIndex $shopIndex, array $backlogs)
    {
        $numbers = $this->getBacklogNumbers($backlogs);
        $queries = $this->getBacklogQueries($backlogs);

        $this->productIndexer->indexProducts($shopIndex$numbers);
        foreach ($queries as $query) {
            while ($queryNumbers = $query->fetch()) {
                $this->productIndexer->indexProducts($shopIndex$queryNumbers);
            }
        }
    }

    /** * {@inheritdoc} */
    public function supports(): string
    {
$idQuery = $this->queryFactory->createCategoryQuery($categoryId, 100);
        $progress->start($idQuery->fetchCount(), 'Indexing products');

        while ($ids = $idQuery->fetch()) {
            if (!$this->variantHelper->getVariantFacet()) {
                $query = $this->queryFactory->createProductIdQuery($ids);
                $numbers = $query->fetch();
            } else {
                $numbers = $ids;
            }

            $this->indexProducts($index$numbers);
            $progress->advance(\count(array_unique($ids)));
        }
        $progress->finish();
    }

    /** * {@inheritdoc} */
    public function supports()
    {
        return ProductMapping::TYPE;
    }
Home | Imprint | This part of the site doesn't use cookies.