Skip to content

Commit 3a8ca16

Browse files
committed
ACP2E-1569: Elasticsearch Indexer document version changes version when new/existing products are imported
1 parent 687f189 commit 3a8ca16

File tree

11 files changed

+12
-327
lines changed

11 files changed

+12
-327
lines changed

app/code/Magento/Catalog/Test/Unit/Model/Indexer/Category/Product/Plugin/ImportTest.php

Lines changed: 0 additions & 37 deletions
This file was deleted.

app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Category/Plugin/ImportTest.php

Lines changed: 0 additions & 37 deletions
This file was deleted.

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
use Magento\Catalog\Api\ProductRepositoryInterface;
1010
use Magento\Catalog\Model\Config as CatalogConfig;
1111
use Magento\Catalog\Model\Product\Visibility;
12+
use Magento\Catalog\Model\Indexer\Product\Category as ProductCategoryIndexer;
13+
use Magento\Catalog\Model\Indexer\Product\Price\Processor as ProductPriceIndexer;
1214
use Magento\CatalogImportExport\Model\Import\Product\ImageTypeProcessor;
1315
use Magento\CatalogImportExport\Model\Import\Product\LinkProcessor;
1416
use Magento\CatalogImportExport\Model\Import\Product\MediaGalleryProcessor;
@@ -2462,13 +2464,15 @@ private function reindexStockStatus(array $productIds): void
24622464
*/
24632465
private function reindexProducts($productIdsToReindex = [])
24642466
{
2465-
$indexer = $this->indexerRegistry->get('catalog_product_category');
2466-
if (is_array($productIdsToReindex) && count($productIdsToReindex) > 0 && !$indexer->isScheduled()) {
2467-
$indexer->reindexList($productIdsToReindex);
2468-
}
2469-
$indexer = $this->indexerRegistry->get('catalog_product_price');
2470-
if (is_array($productIdsToReindex) && count($productIdsToReindex) > 0 && !$indexer->isScheduled()) {
2471-
$indexer->reindexList($productIdsToReindex);
2467+
$indexersToReindex = [
2468+
ProductCategoryIndexer::INDEXER_ID,
2469+
ProductPriceIndexer::INDEXER_ID
2470+
];
2471+
foreach ($indexersToReindex as $id) {
2472+
$indexer = $this->indexerRegistry->get($id);
2473+
if (is_array($productIdsToReindex) && count($productIdsToReindex) > 0 && !$indexer->isScheduled()) {
2474+
$indexer->reindexList($productIdsToReindex);
2475+
}
24722476
}
24732477
}
24742478

app/code/Magento/CatalogImportExport/Model/Indexer/Category/Product/Plugin/Import.php

Lines changed: 0 additions & 41 deletions
This file was deleted.

app/code/Magento/CatalogImportExport/Model/Indexer/Product/Category/Plugin/Import.php

Lines changed: 0 additions & 41 deletions
This file was deleted.

app/code/Magento/CatalogImportExport/Model/Indexer/Product/Price/Plugin/Import.php

Lines changed: 0 additions & 41 deletions
This file was deleted.

app/code/Magento/CatalogImportExport/Model/Indexer/Stock/Plugin/Import.php

Lines changed: 0 additions & 39 deletions
This file was deleted.

app/code/Magento/CatalogImportExport/Test/Unit/Model/Indexer/Product/Price/Plugin/ImportTest.php

Lines changed: 0 additions & 77 deletions
This file was deleted.

app/code/Magento/CatalogImportExport/etc/di.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@
1212
<preference for="Magento\CatalogImportExport\Model\Export\ProductFilterInterface" type="Magento\CatalogImportExport\Model\Export\ProductFilters" />
1313
<type name="Magento\ImportExport\Model\Import">
1414
<plugin name="catalogProductFlatIndexerImport" type="Magento\CatalogImportExport\Model\Indexer\Product\Flat\Plugin\Import" />
15-
<plugin name="invalidatePriceIndexerOnImport" type="Magento\CatalogImportExport\Model\Indexer\Product\Price\Plugin\Import" />
16-
<plugin name="invalidateStockIndexerOnImport" type="Magento\CatalogImportExport\Model\Indexer\Stock\Plugin\Import" />
1715
<plugin name="invalidateEavIndexerOnImport" type="Magento\CatalogImportExport\Model\Indexer\Product\Eav\Plugin\Import" />
18-
<plugin name="invalidateProductCategoryIndexerOnImport" type="Magento\CatalogImportExport\Model\Indexer\Product\Category\Plugin\Import" />
19-
<plugin name="invalidateCategoryProductIndexerOnImport" type="Magento\CatalogImportExport\Model\Indexer\Category\Product\Plugin\Import" />
2016
</type>
2117
<type name="Magento\CatalogImportExport\Model\Import\Product\StockProcessor">
2218
<arguments>

app/code/Magento/CatalogImportExport/etc/import.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,5 @@
99
<entity name="catalog_product" label="Products" model="Magento\CatalogImportExport\Model\Import\Product" behaviorModel="Magento\ImportExport\Model\Source\Import\Behavior\Basic" />
1010
<entityType entity="catalog_product" name="simple" model="Magento\CatalogImportExport\Model\Import\Product\Type\Simple" />
1111
<entityType entity="catalog_product" name="virtual" model="Magento\CatalogImportExport\Model\Import\Product\Type\Virtual" />
12-
<relatedIndexer entity="catalog_product" name="catalog_product_price" />
13-
<relatedIndexer entity="catalog_product" name="catalogsearch_fulltext" />
1412
<relatedIndexer entity="catalog_product" name="catalog_product_flat" />
1513
</config>

0 commit comments

Comments
 (0)