Smile\ElasticsuiteCore\Indexer\GenericIndexerHandler::saveIndex PHP Method

saveIndex() public method

{@inheritDoc}
public saveIndex ( $dimensions, Traversable $documents )
$documents Traversable
    public function saveIndex($dimensions, \Traversable $documents)
    {
        foreach ($dimensions as $dimension) {
            $storeId = $dimension->getValue();
            $index = $this->indexOperation->getIndexByName($this->indexName, $storeId);
            $type = $index->getType($this->typeName);
            foreach ($this->batch->getItems($documents, $this->batchSize) as $batchDocuments) {
                foreach ($type->getDatasources() as $datasource) {
                    $batchDocuments = $datasource->addData($storeId, $batchDocuments);
                }
                $bulk = $this->indexOperation->createBulk()->addDocuments($index, $type, $batchDocuments);
                $this->indexOperation->executeBulk($bulk);
            }
            $this->indexOperation->refreshIndex($index);
            $this->indexOperation->installIndex($index, $storeId);
            $this->cacheHelper->cleanIndexCache($this->indexName, $storeId);
        }
        return $this;
    }