Skip to content

Commit 0d5567b

Browse files
author
Oleksandr Iegorov
committed
MC-42811: Missing Bundled Products on Category Pages
1 parent 0d124ae commit 0d5567b

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

app/code/Magento/Elasticsearch/Model/Indexer/IndexerHandler.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Magento\Framework\Indexer\SaveHandler\IndexerInterface;
1818
use Magento\Framework\Search\Request\Dimension;
1919
use Magento\Framework\Indexer\CacheContext;
20+
use Magento\CatalogSearch\Model\Indexer\Fulltext\Processor;
2021

2122
/**
2223
* Indexer Handler for Elasticsearch engine.
@@ -80,6 +81,11 @@ class IndexerHandler implements IndexerInterface
8081
*/
8182
private $cacheContext;
8283

84+
/**
85+
* @var Processor
86+
*/
87+
private $processor;
88+
8389
/**
8490
* IndexerHandler constructor.
8591
* @param IndexStructureInterface $indexStructure
@@ -91,6 +97,7 @@ class IndexerHandler implements IndexerInterface
9197
* @param int $batchSize
9298
* @param DeploymentConfig|null $deploymentConfig
9399
* @param CacheContext|null $cacheContext
100+
* @param Processor|null $processor
94101
*/
95102
public function __construct(
96103
IndexStructureInterface $indexStructure,
@@ -101,7 +108,8 @@ public function __construct(
101108
array $data = [],
102109
int $batchSize = self::DEFAULT_BATCH_SIZE,
103110
?DeploymentConfig $deploymentConfig = null,
104-
?CacheContext $cacheContext = null
111+
?CacheContext $cacheContext = null,
112+
?Processor $processor = null
105113
) {
106114
$this->indexStructure = $indexStructure;
107115
$this->adapter = $adapter;
@@ -112,6 +120,7 @@ public function __construct(
112120
$this->scopeResolver = $scopeResolver;
113121
$this->deploymentConfig = $deploymentConfig ?: ObjectManager::getInstance()->get(DeploymentConfig::class);
114122
$this->cacheContext = $cacheContext ?: ObjectManager::getInstance()->get(CacheContext::class);
123+
$this->processor = $processor ?: ObjectManager::getInstance()->get(Processor::class);
115124
}
116125

117126
/**
@@ -129,7 +138,9 @@ public function saveIndex($dimensions, \Traversable $documents)
129138
foreach ($this->batch->getItems($documents, $this->batchSize) as $documentsBatch) {
130139
$docs = $this->adapter->prepareDocsPerStore($documentsBatch, $scopeId);
131140
$this->adapter->addDocs($docs, $scopeId, $this->getIndexerId());
132-
$this->updateCacheContext($docs);
141+
if ($this->processor->getIndexer()->isScheduled()) {
142+
$this->updateCacheContext($docs);
143+
}
133144
}
134145
$this->adapter->updateAlias($scopeId, $this->getIndexerId());
135146
return $this;

0 commit comments

Comments
 (0)