]> git.openstreetmap.org Git - nominatim.git/commitdiff
experimental ordering of searches within same rank
authorSarah Hoffmann <lonvia@denofr.de>
Thu, 1 May 2014 08:34:42 +0000 (10:34 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Thu, 1 May 2014 08:34:42 +0000 (10:34 +0200)
giving preference to those without operator and housenumber

lib/lib.php

index 07d5bcf370c60a1e1fe3078480ca9857406f3df6..12f7e57e6eddb2217bceb51bd66a9102fdfe5dd8 100644 (file)
@@ -94,7 +94,8 @@
 
        function bySearchRank($a, $b)
        {
 
        function bySearchRank($a, $b)
        {
-               if ($a['iSearchRank'] == $b['iSearchRank']) return 0;
+               if ($a['iSearchRank'] == $b['iSearchRank'])
+            return strlen($a['sOperator']) + strlen($a['sHouseNumber']) - strlen($b['sOperator']) - strlen($b['sHouseNumber']);
                return ($a['iSearchRank'] < $b['iSearchRank']?-1:1);
        }
 
                return ($a['iSearchRank'] < $b['iSearchRank']?-1:1);
        }