From 72ee1abc90b11d4afefada38bb60b09e37c8e863 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Wed, 26 Aug 2020 17:42:43 +0200 Subject: [PATCH] ensure that ordering by importance is stable The initial search results retrieved from the database already come preordered, either by importnace or by distance. We want to keep that order if all other things are equal. --- lib/lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lib.php b/lib/lib.php index c4fbca30..fcd22066 100644 --- a/lib/lib.php +++ b/lib/lib.php @@ -55,7 +55,7 @@ function byImportance($a, $b) if ($a['importance'] != $b['importance']) return ($a['importance'] > $b['importance']?-1:1); - return ($a['foundorder'] < $b['foundorder']?-1:1); + return $a['foundorder'] <=> $b['foundorder']; } -- 2.39.5