From 60d6a37c8dadacc3224c307466589535f151e1e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jer=C3=B4me=20Bakker?= Date: Mon, 23 May 2022 11:42:36 +0200 Subject: [PATCH] chore: handle more sort_by clauses --- classes/ColdTrick/OpenSearch/SearchParams/Initialize.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/classes/ColdTrick/OpenSearch/SearchParams/Initialize.php b/classes/ColdTrick/OpenSearch/SearchParams/Initialize.php index 7814572..fb77033 100644 --- a/classes/ColdTrick/OpenSearch/SearchParams/Initialize.php +++ b/classes/ColdTrick/OpenSearch/SearchParams/Initialize.php @@ -265,6 +265,10 @@ protected function initializeSorting(array $search_params = []) { $property = elgg_extract('property', $clause); $direction = elgg_extract('direction', $clause, 'desc'); + if (!isset($property_type)) { + $property_type = in_array($property, \ElggEntity::PRIMARY_ATTR_NAMES) ? 'attribute' : 'metadata'; + } + switch ($property_type) { case 'attribute': $this->addSort($property, [