https://github.com/magento/magento2/pull/33227 From 1775766395380c41c60431bed9dd0f7e6da7f606 Mon Sep 17 00:00:00 2001 From: Jasper Zeinstra Date: Sun, 13 Jun 2021 19:47:15 +0200 Subject: [PATCH 1/2] Move catalog search indexer outside stores loop --- .../Fulltext/Plugin/Category/Product/Action/Rows.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/vendor/magento/module-elasticsearch/Model/Indexer/Fulltext/Plugin/Category/Product/Action/Rows.php b/vendor/magento/module-elasticsearch/Model/Indexer/Fulltext/Plugin/Category/Product/Action/Rows.php index 1d1d23017e68c..92b81d2669ca1 100644 --- a/vendor/magento/module-elasticsearch/Model/Indexer/Fulltext/Plugin/Category/Product/Action/Rows.php +++ b/vendor/magento/module-elasticsearch/Model/Indexer/Fulltext/Plugin/Category/Product/Action/Rows.php @@ -77,12 +77,16 @@ public function afterExecute( ): ActionRows { $indexer = $this->indexerRegistry->get(FulltextIndexer::INDEXER_ID); if (!empty($entityIds) && $indexer->isScheduled()) { + $productIds = []; + foreach ($this->storeManager->getStores() as $store) { $indexTable = $this->getIndexTable((int) $store->getId(), $useTempTable); - $productIds = $this->getProductIdsFromIndex($indexTable, $entityIds); - if (!empty($productIds)) { - $indexer->reindexList($productIds); - } + $productIds[] = $this->getProductIdsFromIndex($indexTable, $entityIds); + } + + $productIds = array_merge([], ...$productIds); + if (!empty($productIds)) { + $indexer->reindexList(array_unique($productIds)); } }