Merge pull request #392 from hacklabr/develop
some fixes in ElasticPress class
This commit is contained in:
commit
79ca0db222
|
@ -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(
|
||||||
|
|
Loading…
Reference in New Issue