Skip to content

Commit 953587e

Browse files
committed
ACP2E-2119: fix static and web api tests failures
1 parent e282654 commit 953587e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

app/code/Magento/CatalogGraphQl/DataProvider/Product/SearchCriteriaBuilder.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class SearchCriteriaBuilder
4848
* @var Builder
4949
*/
5050
private $builder;
51+
5152
/**
5253
* @var Visibility
5354
*/
@@ -156,15 +157,16 @@ public function build(array $args, bool $includeAggregation): SearchCriteriaInte
156157
* @param string $requestName
157158
* @param array $matchTypes
158159
* @return void
160+
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
159161
*/
160162
private function updateMatchTypeRequestConfig(string $requestName, array $matchTypes): void
161163
{
162164
$data = $this->searchConfig->get($requestName);
163165
foreach ($data['queries'] as $queryName => $match) {
164166
$attributeName = str_replace('_query', '', $queryName);
165-
if (array_key_exists($attributeName, $matchTypes)) {
166-
foreach ($match as $index => $matchItem) {
167-
$match[$index]['matchCondition'] = 'match_phrase_prefix';
167+
if (isset($match['match']) && in_array($attributeName, $matchTypes, true)) {
168+
foreach ($match['match'] as $index => $matchItem) {
169+
$match['match'][$index]['matchCondition'] = 'match_phrase_prefix';
168170
}
169171
$data['queries'][$queryName] = $match;
170172
}
@@ -183,8 +185,8 @@ private function getPartialMatchFilters(array $args): array
183185
$matchType = [];
184186
foreach ($args['filter'] as $fieldName => $conditions) {
185187
foreach ($conditions as $filter => $value) {
186-
if ($filter === 'match_type') {
187-
$matchType[$fieldName] = $value;
188+
if ($filter === 'match_type' && $value === 'PARTIAL') {
189+
$matchType[$fieldName] = $fieldName;
188190
}
189191
}
190192
}

0 commit comments

Comments
 (0)