Merge branch 'hotfix/0.16.1' of https://github.com/tainacan/tainacan into hotfix/0.16.1

This commit is contained in:
mateuswetah 2020-05-26 09:37:58 -03:00
commit 962867c2dc
1 changed files with 7 additions and 2 deletions

View File

@ -48,6 +48,11 @@ class Elastic_Press {
add_filter( 'ep_config_mapping', [$this, 'elasticpress_config_mapping'], 10, 1 ); 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_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 // add_action('ep_add_query_log', function($query) { //using to DEBUG
// error_log("DEGUG:"); // error_log("DEGUG:");
// error_log($query["args"]["body"]); // error_log($query["args"]["body"]);
@ -445,7 +450,7 @@ class Elastic_Press {
if (!empty($filter['include'])) { if (!empty($filter['include'])) {
$custom_filter_include = $custom_filter; $custom_filter_include = $custom_filter;
$custom_filter_include['bool']['must'][] = ["bool" => [ "must"=> [ [ "terms" => ["$field.term_id" => $filter['include'] ] ] ] ] ]; $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'] = [ $aggs[$id.'.include'] = [
"filter" => $custom_filter_include, "filter" => $custom_filter_include,
"aggs" => array( "aggs" => array(
@ -479,7 +484,7 @@ class Elastic_Press {
$custom_filter_include = $custom_filter; $custom_filter_include = $custom_filter;
$custom_filter_include['bool']['must'][] = ["bool" => [ "must"=> [ [ "terms" => ["$field" => $filter['include'] ] ] ] ] ]; $custom_filter_include['bool']['must'][] = ["bool" => [ "must"=> [ [ "terms" => ["$field" => $filter['include'] ] ] ] ] ];
$meta_label = explode(".",$id)[1] . '.' . explode(".",$id)[2]; $meta_label = explode(".",$id)[1] . '.' . explode(".",$id)[2];
$meta_id_inlcude = "'" . \implode($filter['include'], "','") . "'"; $meta_id_inlcude = "'" . \implode("','", $filter['include']) . "'";
$aggs[$id.'.include'] = [ $aggs[$id.'.include'] = [
"filter" => $custom_filter_include, "filter" => $custom_filter_include,
"aggs" => array( "aggs" => array(