From 87f68937540b406f35feaa3435f951e7dc6d70ec 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. --- 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 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"; -- 2.45.1