Skip to content

Commit 48d31e3

Browse files
authored
ENGCOM-9168: Move catalog search indexer outside stores loop #33227
2 parents a5847b3 + aae9b5c commit 48d31e3

File tree

1 file changed

+8
-4
lines changed
  • app/code/Magento/Elasticsearch/Model/Indexer/Fulltext/Plugin/Category/Product/Action

1 file changed

+8
-4
lines changed

app/code/Magento/Elasticsearch/Model/Indexer/Fulltext/Plugin/Category/Product/Action/Rows.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,16 @@ public function afterExecute(
7777
): ActionRows {
7878
$indexer = $this->indexerRegistry->get(FulltextIndexer::INDEXER_ID);
7979
if (!empty($entityIds) && $indexer->isScheduled()) {
80+
$productIds = [];
81+
8082
foreach ($this->storeManager->getStores() as $store) {
8183
$indexTable = $this->getIndexTable((int) $store->getId(), $useTempTable);
82-
$productIds = $this->getProductIdsFromIndex($indexTable, $entityIds);
83-
if (!empty($productIds)) {
84-
$indexer->reindexList($productIds);
85-
}
84+
$productIds[] = $this->getProductIdsFromIndex($indexTable, $entityIds);
85+
}
86+
87+
$productIds = array_merge([], ...$productIds);
88+
if (!empty($productIds)) {
89+
$indexer->reindexList(array_unique($productIds));
8690
}
8791
}
8892

0 commit comments

Comments
 (0)