Merge branch 'master' into PHRAS-2792_Order_manager_Applied_choice_not_shown_before_order_validation

This commit is contained in:
Nicolas Maillat
2019-11-05 12:45:52 +01:00
committed by GitHub

View File

@@ -46,22 +46,23 @@ class FacetsResponse
if (!isset($bucket['key']) || !isset($bucket['doc_count'])) {
$this->throwAggregationResponseError();
}
$key = array_key_exists('key_as_string', $bucket) ? $bucket['key_as_string'] : $bucket['key'];
if($tf) {
// the field is one of the hardcoded tech fields
$value = [
'value' => $valueFormatter($bucket['key']),
'raw_value' => $bucket['key'],
'value' => $valueFormatter($key),
'raw_value' => $key,
'count' => $bucket['doc_count'],
'query' => sprintf($tf['query'], $this->escaper->escapeWord($bucket['key']))
'query' => sprintf($tf['query'], $this->escaper->escapeWord($key))
];
}
else {
// the field is a normal field
$value = [
'value' => $bucket['key'],
'raw_value' => $bucket['key'],
'value' => $key,
'raw_value' => $key,
'count' => $bucket['doc_count'],
'query' => sprintf('field.%s:%s', $this->escaper->escapeWord($name), $this->escaper->escapeWord($bucket['key']))
'query' => sprintf('field.%s:%s', $this->escaper->escapeWord($name), $this->escaper->escapeWord($key))
];
}