From: Sarah Hoffmann Date: Mon, 19 Feb 2018 22:24:12 +0000 (+0100) Subject: do not allow importance to become 0 X-Git-Tag: deploy~337 X-Git-Url: https://git.openstreetmap.org/nominatim.git/commitdiff_plain/87f68937540b406f35feaa3435f951e7dc6d70ec do not allow importance to become 0 Importance is weighed against a viewbox factor which disappears when the importance is 0. --- diff --git a/lib/Geocode.php b/lib/Geocode.php index 643af8e1..184fd0f5 100644 --- a/lib/Geocode.php +++ b/lib/Geocode.php @@ -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) { diff --git a/lib/SearchDescription.php b/lib/SearchDescription.php index 5431b3eb..6b66e5a5 100644 --- a/lib/SearchDescription.php +++ b/lib/SearchDescription.php @@ -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";