Skip to content

Commit bff4a69

Browse files
committed
ACP2E-1499: Attributes weight didn't work in search keyword
- fix
1 parent c82c795 commit bff4a69

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

app/code/Magento/CatalogSearch/Model/Search/Request/PartialSearchModifier.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,12 @@ public function modify(array $requests): array
4141
if ($matches) {
4242
foreach ($matches as $index => $match) {
4343
$field = $match['field'] ?? null;
44-
if ($field && $field !== '*' && !isset($attributes[$field])) {
45-
unset($matches[$index]);
44+
if ($field && $field !== '*') {
45+
if (!isset($attributes[$field])) {
46+
unset($matches[$index]);
47+
continue;
48+
}
49+
$matches[$index]['boost'] = $attributes[$field]->getSearchWeight() ?: 1;
4650
}
4751
}
4852
$requests[$code]['queries']['partial_search']['match'] = array_values($matches);

0 commit comments

Comments
 (0)