debugs API elasticpress

This commit is contained in:
vnmedeiros 2019-01-18 17:04:39 -02:00
parent ff071f14ab
commit aa46824ece
2 changed files with 6 additions and 4 deletions

View File

@ -279,6 +279,7 @@ class REST_Items_Controller extends REST_Controller {
$items = $this->items_repository->fetch($args, $collection_id, 'WP_Query');
//mas e se não estiver usando o plugin? vai voltar "null"
$items_aggregations = \Tainacan\Elastic_Press::get_instance()->last_aggregations; //if elasticPress active
$response['facets'] = $items_aggregations;
$response['items'] = [];

View File

@ -38,9 +38,10 @@ class Elastic_Press {
$this->last_aggregations = $aggregations;
}, 10, 3);
//add_action('ep_add_query_log', function($query) { //using to DEBUG
//error_log($query["args"]["body"]);
//});
// add_action('ep_add_query_log', function($query) { //using to DEBUG
// error_log("DEGUG:");
// error_log($query["args"]["body"]);
// });
}
function filter_args($args, $type) {
@ -137,7 +138,7 @@ class Elastic_Press {
foreach ($custom_filter['bool']['must'] as $item) {
if ( isset($item['bool'])) {
foreach ($item['bool']["must"] as $item_filter) {
if ( !isset( $item_filter["terms"][$filter['key']] ) ) {
if ( !isset( $item_filter["terms"][$filter['key']] ) ) { //do use array_filter ?
$temp[] = $item;
}
}