From c5181226ce6e6202638d31503deba81a4a0c9524 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=82=E6=B5=81?= Date: Mon, 10 Jul 2023 21:27:49 +0800 Subject: [PATCH] Fix ordering by attribute and related attributes This fixes sorting by attributes which data type do not use value_sortable field. This includes attribute of type currency, file size, floor plan, geocode, integer, length, time code, weight, and also date range in older versions of Providence. --- app/lib/BaseFindEngine.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/lib/BaseFindEngine.php b/app/lib/BaseFindEngine.php index 5f1458c0c8..d9522e2632 100644 --- a/app/lib/BaseFindEngine.php +++ b/app/lib/BaseFindEngine.php @@ -734,7 +734,7 @@ private function _sortByAttribute($t_table, string $hit_table, ?string $element_ FROM ca_attribute_values cav FORCE INDEX(i_sorting) INNER JOIN {$attr_tmp_table} AS attr_tmp ON attr_tmp.attribute_id = cav.attribute_id WHERE cav.element_id = ? - ORDER BY cav.value_sortable {$direction} + ORDER BY cav.{$attr_val_sort_field} {$direction} {$limit_sql}"; $qr_sort = $this->db->query($sql, [$element_id]); @@ -873,7 +873,7 @@ private function _sortByRelatedAttribute($t_table, $t_rel_table, string $hit_tab INNER JOIN {$hit_table} AS ht ON ht.row_id = t.{$table_pk} {$filter_join} WHERE cav.element_id = ? {$filter_where} - ORDER BY cav.value_sortable {$direction} + ORDER BY cav.{$attr_val_sort_field} {$direction} {$limit_sql}"; $qr_sort = $this->db->query($sql, [$element_id]); $sort_keys = [];