From df008d99f549d850d07580b4592435388e44387c Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Mon, 19 Feb 2018 23:24:12 +0100 Subject: [PATCH] do not allow importance to become 0 Importance is weighed against a viewbox factor which disappears when the importance is 0. Fixes #930. --- lib/Geocode.php | 4 ++-- lib/SearchDescription.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Geocode.php b/lib/Geocode.php index d5647c76..26fafb73 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 c379fdf3..a1910231 100644 --- a/lib/SearchDescription.php +++ b/lib/SearchDescription.php @@ -679,7 +679,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"; -- 2.39.5