Skip to content

Commit 621bf70

Browse files
committed
ACP2E-1875: [Magento Cloud] Products incorrectly showed Out of Stock then all products show in stock
- stacked indexer actions
1 parent 17393b6 commit 621bf70

File tree

6 files changed

+34
-8
lines changed

6 files changed

+34
-8
lines changed

app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
use Magento\CatalogSearch\Model\Indexer\Scope\State;
1111
use Magento\CatalogSearch\Model\Indexer\Scope\StateFactory;
1212
use Magento\CatalogSearch\Model\ResourceModel\Fulltext as FulltextResource;
13-
use Magento\Elasticsearch\Model\Indexer\EnhancedIndexerHandler;
1413
use Magento\Framework\App\ObjectManager;
1514
use Magento\Framework\Indexer\DimensionProviderInterface;
15+
use Magento\Framework\Indexer\SaveHandler\EnhancedIndexerInterface;
1616
use Magento\Store\Model\StoreDimensionProvider;
1717
use Magento\Indexer\Model\ProcessManager;
1818
use Magento\Framework\App\DeploymentConfig;
@@ -102,7 +102,7 @@ class Fulltext implements
102102
private $deploymentConfig;
103103

104104
/**
105-
* @var EnhancedIndexerHandler
105+
* @var EnhancedIndexerInterface
106106
*/
107107
private $enhancedIndexerHandler;
108108

@@ -117,7 +117,7 @@ class Fulltext implements
117117
* @param ProcessManager|null $processManager
118118
* @param int|null $batchSize
119119
* @param DeploymentConfig|null $deploymentConfig
120-
* @param EnhancedIndexerHandler|null $enhancedIndexerHandler
120+
* @param EnhancedIndexerInterface|null $enhancedIndexerHandler
121121
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
122122
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
123123
*/
@@ -132,7 +132,7 @@ public function __construct(
132132
ProcessManager $processManager = null,
133133
?int $batchSize = null,
134134
?DeploymentConfig $deploymentConfig = null,
135-
?EnhancedIndexerHandler $enhancedIndexerHandler = null
135+
?EnhancedIndexerInterface $enhancedIndexerHandler = null
136136
) {
137137
$this->fullAction = $fullActionFactory->create(['data' => $data]);
138138
$this->indexerHandlerFactory = $indexerHandlerFactory;
@@ -145,7 +145,7 @@ public function __construct(
145145
$this->batchSize = $batchSize ?? self::BATCH_SIZE;
146146
$this->deploymentConfig = $deploymentConfig ?: ObjectManager::getInstance()->get(DeploymentConfig::class);
147147
$this->enhancedIndexerHandler = $enhancedIndexerHandler ?:
148-
ObjectManager::getInstance()->create(EnhancedIndexerHandler::class, ['data' => $this->data]);
148+
ObjectManager::getInstance()->create(EnhancedIndexerInterface::class, ['data' => $this->data]);
149149
}
150150

151151
/**
@@ -212,13 +212,13 @@ public function executeByDimensions(array $dimensions, \Traversable $entityIds =
212212
/**
213213
* Process batch
214214
*
215-
* @param EnhancedIndexerHandler $saveHandler
215+
* @param EnhancedIndexerInterface $saveHandler
216216
* @param array $dimensions
217217
* @param array $entityIds
218218
* @throws \Exception
219219
*/
220220
private function processBatch(
221-
EnhancedIndexerHandler $saveHandler,
221+
EnhancedIndexerInterface $saveHandler,
222222
array $dimensions,
223223
array $entityIds
224224
) : void {

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
use Magento\Framework\Indexer\CacheContext;
1616
use Magento\Framework\Indexer\IndexStructureInterface;
1717
use Magento\Framework\Indexer\SaveHandler\Batch;
18+
use Magento\Framework\Indexer\SaveHandler\EnhancedIndexerInterface;
1819

19-
class EnhancedIndexerHandler extends IndexerHandler
20+
class EnhancedIndexerHandler extends IndexerHandler implements EnhancedIndexerInterface
2021
{
2122
/**
2223
* @var ElasticsearchAdapter
@@ -35,6 +36,7 @@ class EnhancedIndexerHandler extends IndexerHandler
3536
* @param DeploymentConfig|null $deploymentConfig
3637
* @param CacheContext|null $cacheContext
3738
* @param Processor|null $processor
39+
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
3840
*/
3941
public function __construct(
4042
IndexStructureInterface $indexStructure,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<preference for="Magento\Framework\Search\Dynamic\DataProviderInterface" type="Magento\Elasticsearch\SearchAdapter\Dynamic\DataProvider" />
1717
<preference for="Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection\SearchResultApplierInterface" type="Magento\Elasticsearch\Model\ResourceModel\Fulltext\Collection\SearchResultApplier"/>
1818
<preference for="Magento\Elasticsearch\Model\DataProvider\Base\GetSuggestionFrequencyInterface" type="Magento\Elasticsearch\Model\DataProvider\Base\GetSuggestionFrequency"/>
19+
<preference for="Magento\Framework\Indexer\SaveHandler\EnhancedIndexerInterface" type="Magento\Elasticsearch\Model\Indexer\EnhancedIndexerHandler"/>
1920
<type name="Magento\Catalog\Model\Indexer\Category\Product\Action\Rows">
2021
<plugin name="catalogsearchFulltextProductAssignment" type="Magento\Elasticsearch\Model\Indexer\Fulltext\Plugin\Category\Product\Action\Rows"/>
2122
</type>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
9+
<preference for="Magento\Framework\Indexer\SaveHandler\EnhancedIndexerInterface" type="Magento\Elasticsearch\Model\Indexer\EnhancedIndexerHandler"/>
910
<type name="Magento\Elasticsearch\Model\Config">
1011
<arguments>
1112
<argument name="engineList" xsi:type="array">

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
10+
<preference for="Magento\Framework\Indexer\SaveHandler\EnhancedIndexerInterface" type="Magento\Elasticsearch\Model\Indexer\EnhancedIndexerHandler"/>
1011
<type name="Magento\Elasticsearch\Model\Config">
1112
<arguments>
1213
<argument name="engineList" xsi:type="array">
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace Magento\Framework\Indexer\SaveHandler;
4+
5+
interface EnhancedIndexerInterface extends IndexerInterface
6+
{
7+
/**
8+
* @return void
9+
*/
10+
public function disableStackedActions(): void;
11+
12+
/**
13+
* @return void
14+
*/
15+
public function enableStackedActions(): void;
16+
17+
/**
18+
* @return void
19+
*/
20+
public function triggerStackedActions(): void;
21+
}

0 commit comments

Comments
 (0)