Skip to content

Commit bd343f0

Browse files
committed
MC-37006: Adding/removing disabled products to Magento flushes categories cache
1 parent ece5d58 commit bd343f0

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

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

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@
66

77
namespace Magento\CatalogSearch\Model\Indexer;
88

9-
use Magento\Catalog\Model\Product;
109
use Magento\CatalogSearch\Model\Indexer\Fulltext\Action\FullFactory;
1110
use Magento\CatalogSearch\Model\Indexer\Scope\State;
1211
use Magento\CatalogSearch\Model\Indexer\Scope\StateFactory;
1312
use Magento\CatalogSearch\Model\ResourceModel\Fulltext as FulltextResource;
1413
use Magento\Framework\App\ObjectManager;
15-
use Magento\Framework\Indexer\CacheContext;
1614
use Magento\Framework\Indexer\DimensionProviderInterface;
1715
use Magento\Store\Model\StoreDimensionProvider;
1816
use Magento\Indexer\Model\ProcessManager;
@@ -79,11 +77,6 @@ class Fulltext implements
7977
*/
8078
private $processManager;
8179

82-
/**
83-
* @var CacheContext
84-
*/
85-
private $cacheContext;
86-
8780
/**
8881
* @param FullFactory $fullActionFactory
8982
* @param IndexerHandlerFactory $indexerHandlerFactory
@@ -93,7 +86,6 @@ class Fulltext implements
9386
* @param DimensionProviderInterface $dimensionProvider
9487
* @param array $data
9588
* @param ProcessManager $processManager
96-
* @param CacheContext|null $cacheContext
9789
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
9890
*/
9991
public function __construct(
@@ -104,8 +96,7 @@ public function __construct(
10496
StateFactory $indexScopeStateFactory,
10597
DimensionProviderInterface $dimensionProvider,
10698
array $data,
107-
ProcessManager $processManager = null,
108-
CacheContext $cacheContext = null
99+
ProcessManager $processManager = null
109100
) {
110101
$this->fullAction = $fullActionFactory->create(['data' => $data]);
111102
$this->indexerHandlerFactory = $indexerHandlerFactory;
@@ -115,7 +106,6 @@ public function __construct(
115106
$this->indexScopeState = ObjectManager::getInstance()->get(State::class);
116107
$this->dimensionProvider = $dimensionProvider;
117108
$this->processManager = $processManager ?: ObjectManager::getInstance()->get(ProcessManager::class);
118-
$this->cacheContext = $cacheContext ?? ObjectManager::getInstance()->get(CacheContext::class);
119109
}
120110

121111
/**
@@ -155,8 +145,6 @@ public function executeByDimensions(array $dimensions, \Traversable $entityIds =
155145
$saveHandler->saveIndex($dimensions, $this->fullAction->rebuildStoreIndex($storeId));
156146

157147
$this->fulltextResource->resetSearchResultsByStore($storeId);
158-
159-
$this->cacheContext->registerTags([Product::CACHE_TAG]);
160148
} else {
161149
// internal implementation works only with array
162150
$entityIds = iterator_to_array($entityIds);
@@ -167,8 +155,6 @@ public function executeByDimensions(array $dimensions, \Traversable $entityIds =
167155
$saveHandler->deleteIndex($dimensions, new \ArrayIterator($productIds));
168156
$saveHandler->saveIndex($dimensions, $this->fullAction->rebuildStoreIndex($storeId, $productIds));
169157
}
170-
171-
$this->cacheContext->registerEntities(Product::CACHE_TAG, $productIds);
172158
}
173159
}
174160

0 commit comments

Comments
 (0)