private function getSorting(ManualSorting
$criteriaPart, CategoryCondition
$categoryCondition): FieldSort
{ $categoryId =
$categoryCondition->
getCategoryIds()[0
];
// Elasticsearch DSL does not support the new format
// @see: https://www.elastic.co/guide/en/elasticsearch/reference/6.8/search-request-sort.html#_nested_sorting_examples
return new FieldSort('manualSorting.position',
strtolower($criteriaPart->
getDirection()),
[ 'unmapped_type' => 'integer',
'nested' =>
[ 'path' => 'manualSorting',
'filter'
=> (new TermsQuery('manualSorting.category_id',
[$categoryId]))->
toArray(),
],
]);
}}