Skip to content

Commit

Permalink
[Optimizer] Fix display of boost value/weight grid column
Browse files Browse the repository at this point in the history
  • Loading branch information
rbayet committed Oct 16, 2024
1 parent 21249e8 commit 0585cf5
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,18 @@ public function prepareDataSource(array $dataSource)
{
if (isset($dataSource['data']['items'])) {
foreach ($dataSource['data']['items'] as &$item) {
$value = '';
$config = $this->serializer->unserialize($item['config']);
$value = $config['constant_score_value'] ? ($config['constant_score_value'] . '%') : '';
$type = $item['model'] ?? 'constant_score';
if ($type === 'constant_score') {
$value = $config['constant_score_value'] ? ($config['constant_score_value'] . '%') : '';
} elseif ($type === 'attribute_value') {
$factor = $config['scale_factor'] ?? '';
$modifier = $config['scale_function'] ?? '';
$field = $config['attribute_code'] ?? '';
$value = sprintf("%s(%s * %s)", $modifier, $factor, $field);
}

$item[$this->getData('name')] = $value;
}
}
Expand Down

0 comments on commit 0585cf5

Please sign in to comment.