Skip to content

Commit 86cdf38

Browse files
committed
MC-42795: GraphQl products query layered navigation filters return incorrect child categories list
1 parent 340a8f4 commit 86cdf38

File tree

3 files changed

+1
-189
lines changed

3 files changed

+1
-189
lines changed

app/code/Magento/CatalogGraphQl/Model/Resolver/Products/Query/ResolveCategoryAggregation.php

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

app/code/Magento/CatalogGraphQl/Model/Resolver/Products/Query/Search.php

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ class Search implements ProductQueryInterface
5555
*/
5656
private $productsProvider;
5757

58-
/**
59-
* @var ResolveCategoryAggregation
60-
*/
61-
private $resolveCategoryAggregation;
62-
6358
/**
6459
* @var SearchCriteriaBuilder
6560
*/
@@ -73,7 +68,6 @@ class Search implements ProductQueryInterface
7368
* @param ProductSearch $productsProvider
7469
* @param SearchCriteriaBuilder $searchCriteriaBuilder
7570
* @param ArgumentsProcessorInterface|null $argsSelection
76-
* @param ResolveCategoryAggregation $resolveCategoryAggregation
7771
*/
7872
public function __construct(
7973
SearchInterface $search,
@@ -82,7 +76,6 @@ public function __construct(
8276
FieldSelection $fieldSelection,
8377
ProductSearch $productsProvider,
8478
SearchCriteriaBuilder $searchCriteriaBuilder,
85-
ResolveCategoryAggregation $resolveCategoryAggregation,
8679
ArgumentsProcessorInterface $argsSelection = null
8780
) {
8881
$this->search = $search;
@@ -91,8 +84,6 @@ public function __construct(
9184
$this->fieldSelection = $fieldSelection;
9285
$this->productsProvider = $productsProvider;
9386
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
94-
$this->resolveCategoryAggregation = $resolveCategoryAggregation ?: ObjectManager::getInstance()
95-
->get(ResolveCategoryAggregation::class);
9687
$this->argsSelection = $argsSelection ?: ObjectManager::getInstance()
9788
->get(ArgumentsProcessorInterface::class);
9889
}
@@ -133,17 +124,6 @@ public function getResult(
133124

134125
$totalPages = $realPageSize ? ((int)ceil($searchResults->getTotalCount() / $realPageSize)) : 0;
135126

136-
$aggregations = $itemsResults->getAggregations();
137-
$bucketList = $aggregations->getBuckets();
138-
$categoryFilter = $args['filter']['category_id'] ?? [];
139-
140-
if (!empty($categoryFilter) && isset($bucketList[ResolveCategoryAggregation::CATEGORY_BUCKET])) {
141-
$aggregations = $this->resolveCategoryAggregation->getResolvedCategoryAggregation(
142-
$categoryFilter,
143-
$bucketList
144-
);
145-
}
146-
147127
$productArray = [];
148128
/** @var \Magento\Catalog\Model\Product $product */
149129
foreach ($searchResults->getItems() as $product) {
@@ -155,7 +135,7 @@ public function getResult(
155135
[
156136
'totalCount' => $searchResults->getTotalCount(),
157137
'productsSearchResult' => $productArray,
158-
'searchAggregation' => $aggregations,
138+
'searchAggregation' => $itemsResults->getAggregations(),
159139
'pageSize' => $realPageSize,
160140
'currentPage' => $realCurrentPage,
161141
'totalPages' => $totalPages,
@@ -169,7 +149,6 @@ public function getResult(
169149
* @param array $args
170150
* @param ResolveInfo $info
171151
* @return SearchCriteriaInterface
172-
* @throws GraphQlInputException
173152
*/
174153
private function buildSearchCriteria(array $args, ResolveInfo $info): SearchCriteriaInterface
175154
{

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,6 @@
8585
</arguments>
8686
</type>
8787

88-
<type name="Magento\CatalogGraphQl\Model\Resolver\Products\Query\Search">
89-
<arguments>
90-
<argument name="resolveCategoryAggregation" xsi:type="object">Magento\CatalogGraphQl\Model\Resolver\Products\Query\ResolveCategoryAggregation\Proxy</argument>
91-
</arguments>
92-
</type>
93-
9488
<type name="Magento\Framework\Search\Request\Config\FilesystemReader">
9589
<plugin name="productAttributesDynamicFields" type="Magento\CatalogGraphQl\Plugin\Search\Request\ConfigReader" />
9690
</type>

0 commit comments

Comments
 (0)