add value on last_term
This commit is contained in:
parent
8eefeae7be
commit
4d0e2e534a
|
@ -365,16 +365,21 @@ class Elastic_Press {
|
|||
$itemsRepo = \Tainacan\Repositories\Items::get_instance();
|
||||
$items = $itemsRepo->fetch($args['items_filter'], $args['collection_id'], 'WP_Query');
|
||||
$items_aggregations = $this->last_aggregations; //if elasticPress active
|
||||
|
||||
$last_term = [];
|
||||
if(isset($items_aggregations['last_term'])) {
|
||||
$value = explode('.', $items_aggregations['last_term']);
|
||||
$last_term = [
|
||||
'value' => sizeof($value) > 1 ? $value[sizeof($value)-2] : $value[0],
|
||||
'es_term' => $items_aggregations['last_term']
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
// 'total' => count($items_aggregations),
|
||||
// 'pages' => '0', //TODO get a total of pages
|
||||
'values' => isset($items_aggregations['values']) ? $items_aggregations['values'] : [] ,
|
||||
'last_term' => isset($items_aggregations['last_term']) ?
|
||||
[
|
||||
'label' => explode('.', $items_aggregations['last_term'])[0],
|
||||
'es_term'=>$items_aggregations['last_term']
|
||||
] : ''
|
||||
'values' => isset($items_aggregations['values']) ? $items_aggregations['values'] : [],
|
||||
'last_term' => $last_term
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue