@@ -48,6 +48,7 @@ class SearchCriteriaBuilder
48
48
* @var Builder
49
49
*/
50
50
private $ builder ;
51
+
51
52
/**
52
53
* @var Visibility
53
54
*/
@@ -156,15 +157,16 @@ public function build(array $args, bool $includeAggregation): SearchCriteriaInte
156
157
* @param string $requestName
157
158
* @param array $matchTypes
158
159
* @return void
160
+ * @SuppressWarnings(PHPMD.UnusedLocalVariable)
159
161
*/
160
162
private function updateMatchTypeRequestConfig (string $ requestName , array $ matchTypes ): void
161
163
{
162
164
$ data = $ this ->searchConfig ->get ($ requestName );
163
165
foreach ($ data ['queries ' ] as $ queryName => $ match ) {
164
166
$ 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 ' ;
168
170
}
169
171
$ data ['queries ' ][$ queryName ] = $ match ;
170
172
}
@@ -183,8 +185,8 @@ private function getPartialMatchFilters(array $args): array
183
185
$ matchType = [];
184
186
foreach ($ args ['filter ' ] as $ fieldName => $ conditions ) {
185
187
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 ;
188
190
}
189
191
}
190
192
}
0 commit comments