]> git.openstreetmap.org Git - nominatim.git/commitdiff
fix handling of zero importance
authorSarah Hoffmann <lonvia@denofr.de>
Wed, 29 Jun 2022 15:54:30 +0000 (17:54 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Wed, 29 Jun 2022 15:54:30 +0000 (17:54 +0200)
To avoid importance becoming zero and cancelling out other weights,
df008d99f549d850d07580b4592435388e44387c introduced a minimum value
for importance. That broke importances for interpolated addresses,
which are less than zero.

Instead of setting a minimum, set zero importances to a very small
value.

Fixes #2753.

lib-php/Geocode.php

index bf9a32625c746ab63f22effd99575d6db91dc555..acb79493734c6ece129e341b74d035f89743ac57 100644 (file)
@@ -843,7 +843,9 @@ class Geocode
                 $aResult['importance'] = 0.001;
                 $aResult['foundorder'] = $aResult['addressimportance'];
             } else {
                 $aResult['importance'] = 0.001;
                 $aResult['foundorder'] = $aResult['addressimportance'];
             } else {
-                $aResult['importance'] = max(0.001, $aResult['importance']);
+                if ($aResult['importance'] == 0) {
+                    $aResult['importance'] = 0.0001;
+                }
                 $aResult['importance'] *= $this->viewboxImportanceFactor(
                     $aResult['lon'],
                     $aResult['lat']
                 $aResult['importance'] *= $this->viewboxImportanceFactor(
                     $aResult['lon'],
                     $aResult['lat']