diff --git a/src/classes/class-tainacan-elastic-press.php b/src/classes/class-tainacan-elastic-press.php index 01e2a4eb7..f139faa8c 100644 --- a/src/classes/class-tainacan-elastic-press.php +++ b/src/classes/class-tainacan-elastic-press.php @@ -48,6 +48,11 @@ class Elastic_Press { add_filter( 'ep_config_mapping', [$this, 'elasticpress_config_mapping'], 10, 1 ); add_filter( 'ep_post_sync_args', [$this, 'ep_post_sync_args'], 10, 2 ); + add_filter( 'ep_formatted_args', function ( $formatted_args ) { + $formatted_args['track_total_hits'] = true; + return $formatted_args; + } ); + // add_action('ep_add_query_log', function($query) { //using to DEBUG // error_log("DEGUG:"); // error_log($query["args"]["body"]); @@ -445,7 +450,7 @@ class Elastic_Press { if (!empty($filter['include'])) { $custom_filter_include = $custom_filter; $custom_filter_include['bool']['must'][] = ["bool" => [ "must"=> [ [ "terms" => ["$field.term_id" => $filter['include'] ] ] ] ] ]; - $terms_id_inlcude = \implode($filter['include'], ","); + $terms_id_inlcude = \implode( ",", $filter['include']); $aggs[$id.'.include'] = [ "filter" => $custom_filter_include, "aggs" => array( @@ -479,7 +484,7 @@ class Elastic_Press { $custom_filter_include = $custom_filter; $custom_filter_include['bool']['must'][] = ["bool" => [ "must"=> [ [ "terms" => ["$field" => $filter['include'] ] ] ] ] ]; $meta_label = explode(".",$id)[1] . '.' . explode(".",$id)[2]; - $meta_id_inlcude = "'" . \implode($filter['include'], "','") . "'"; + $meta_id_inlcude = "'" . \implode("','", $filter['include']) . "'"; $aggs[$id.'.include'] = [ "filter" => $custom_filter_include, "aggs" => array(