do not allow importance to become 0

Importance is weighed against a viewbox factor which disappears
when the importance is 0.

Fixes #930.
This commit is contained in:
Sarah Hoffmann
2018-02-19 23:24:12 +01:00
parent fd920fba9b
commit df008d99f5
2 changed files with 3 additions and 3 deletions

View 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) {

View File

@@ -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";