fix sorting by metadatas on using elasticsearch

This commit is contained in:
vnmedeiros 2019-05-15 12:14:18 -03:00
parent 2450539c4a
commit 5b330c88be
1 changed files with 9 additions and 0 deletions

View File

@ -265,6 +265,15 @@ class Elastic_Press {
$formatted_args = $this->prepare_request_for_facet($formatted_args);
break;
}
if( isset($formatted_args['sort']) ) {
$new_sort = [];
foreach ($formatted_args['sort'] as $sort) {
foreach ($sort as $key => $value) {
$new_sort["$key.raw"] = $value;
}
}
$formatted_args['sort'] = $new_sort;
}
return $formatted_args;
}