]> git.openstreetmap.org Git - nominatim.git/commitdiff
ensure that ordering by importance is stable
authorSarah Hoffmann <lonvia@denofr.de>
Wed, 26 Aug 2020 15:42:43 +0000 (17:42 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Wed, 26 Aug 2020 15:42:43 +0000 (17:42 +0200)
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

index c4fbca308636e60e0cd0e59a27fc63eb517b7597..fcd220667bcdede296654b8db9d80a827f9dab8e 100644 (file)
@@ -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'];
 }