]> git.openstreetmap.org Git - nominatim.git/commitdiff
do not allow importance to become 0
authorSarah Hoffmann <lonvia@denofr.de>
Mon, 19 Feb 2018 22:24:12 +0000 (23:24 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Mon, 19 Feb 2018 22:42:03 +0000 (23:42 +0100)
Importance is weighed against a viewbox factor which disappears
when the importance is 0.

lib/Geocode.php
lib/SearchDescription.php

index 643af8e12784bac4cf92723050522e0aab1f0ced..184fd0f540974795178540d178a9f69133419924 100644 (file)
@@ -921,12 +921,12 @@ class Geocode
                 $aResult['importance'] = 0.001;
                 $aResult['foundorder'] = $aResult['addressimportance'];
             } else {
-                // Adjust importance for the number of exact string matches in the result
+                $aResult['importance'] = max(0.001, $aResult['importance']);
                 $aResult['importance'] *= $this->viewboxImportanceFactor(
                     $aResult['lon'],
                     $aResult['lat']
                 );
-                $aResult['importance'] = max(0.001, $aResult['importance']);
+                // Adjust importance for the number of exact string matches in the result
                 $iCountWords = 0;
                 $sAddress = $aResult['langaddress'];
                 foreach ($aRecheckWords as $i => $sWord) {
index 5431b3eb957907417d38f130a3dd91abeb6bfc6f..6b66e5a552342724a03aee2d79d45768c24981f8 100644 (file)
@@ -675,7 +675,7 @@ class SearchDescription
         if ($this->sHouseNumber) {
             $sImportanceSQL = '- abs(26 - address_rank) + 3';
         } else {
-            $sImportanceSQL = '(CASE WHEN importance = 0 OR importance IS NULL THEN 0.75-(search_rank::float/40) ELSE importance END)';
+            $sImportanceSQL = '(CASE WHEN importance = 0 OR importance IS NULL THEN 0.75001-(search_rank::float/40) ELSE importance END)';
         }
         $sImportanceSQL .= $this->oContext->viewboxImportanceSQL('centroid');
         $aOrder[] = "$sImportanceSQL DESC";