@@ -55,11 +55,6 @@ class Search implements ProductQueryInterface
55
55
*/
56
56
private $ productsProvider ;
57
57
58
- /**
59
- * @var ResolveCategoryAggregation
60
- */
61
- private $ resolveCategoryAggregation ;
62
-
63
58
/**
64
59
* @var SearchCriteriaBuilder
65
60
*/
@@ -73,7 +68,6 @@ class Search implements ProductQueryInterface
73
68
* @param ProductSearch $productsProvider
74
69
* @param SearchCriteriaBuilder $searchCriteriaBuilder
75
70
* @param ArgumentsProcessorInterface|null $argsSelection
76
- * @param ResolveCategoryAggregation $resolveCategoryAggregation
77
71
*/
78
72
public function __construct (
79
73
SearchInterface $ search ,
@@ -82,7 +76,6 @@ public function __construct(
82
76
FieldSelection $ fieldSelection ,
83
77
ProductSearch $ productsProvider ,
84
78
SearchCriteriaBuilder $ searchCriteriaBuilder ,
85
- ResolveCategoryAggregation $ resolveCategoryAggregation ,
86
79
ArgumentsProcessorInterface $ argsSelection = null
87
80
) {
88
81
$ this ->search = $ search ;
@@ -91,8 +84,6 @@ public function __construct(
91
84
$ this ->fieldSelection = $ fieldSelection ;
92
85
$ this ->productsProvider = $ productsProvider ;
93
86
$ this ->searchCriteriaBuilder = $ searchCriteriaBuilder ;
94
- $ this ->resolveCategoryAggregation = $ resolveCategoryAggregation ?: ObjectManager::getInstance ()
95
- ->get (ResolveCategoryAggregation::class);
96
87
$ this ->argsSelection = $ argsSelection ?: ObjectManager::getInstance ()
97
88
->get (ArgumentsProcessorInterface::class);
98
89
}
@@ -133,17 +124,6 @@ public function getResult(
133
124
134
125
$ totalPages = $ realPageSize ? ((int )ceil ($ searchResults ->getTotalCount () / $ realPageSize )) : 0 ;
135
126
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
-
147
127
$ productArray = [];
148
128
/** @var \Magento\Catalog\Model\Product $product */
149
129
foreach ($ searchResults ->getItems () as $ product ) {
@@ -155,7 +135,7 @@ public function getResult(
155
135
[
156
136
'totalCount ' => $ searchResults ->getTotalCount (),
157
137
'productsSearchResult ' => $ productArray ,
158
- 'searchAggregation ' => $ aggregations ,
138
+ 'searchAggregation ' => $ itemsResults -> getAggregations () ,
159
139
'pageSize ' => $ realPageSize ,
160
140
'currentPage ' => $ realCurrentPage ,
161
141
'totalPages ' => $ totalPages ,
@@ -169,7 +149,6 @@ public function getResult(
169
149
* @param array $args
170
150
* @param ResolveInfo $info
171
151
* @return SearchCriteriaInterface
172
- * @throws GraphQlInputException
173
152
*/
174
153
private function buildSearchCriteria (array $ args , ResolveInfo $ info ): SearchCriteriaInterface
175
154
{
0 commit comments