From: Sarah Hoffmann Date: Wed, 26 Aug 2020 15:42:43 +0000 (+0200) Subject: ensure that ordering by importance is stable X-Git-Tag: v3.6.0~85^2 X-Git-Url: https://git.openstreetmap.org/nominatim.git/commitdiff_plain/72ee1abc90b11d4afefada38bb60b09e37c8e863?hp=9e1909643c63375dfb9e81528e41024fc4cfb114 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. --- 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']; }