X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/f404b81388537f33a4a9355991f8eeecd914a5b9..163b488591181e05a1ca0f80923ff7d5d309c71b:/lib/Geocode.php?ds=inline diff --git a/lib/Geocode.php b/lib/Geocode.php index c345bf36..016fc101 100644 --- a/lib/Geocode.php +++ b/lib/Geocode.php @@ -1277,9 +1277,17 @@ if ($bBoundingBoxSearch) $aTerms[] = "centroid && $this->sViewboxSmallSQL"; if ($sNearPointSQL) $aOrder[] = "ST_Distance($sNearPointSQL, centroid) asc"; - $sImportanceSQL = '(case when importance = 0 OR importance IS NULL then 0.75-(search_rank::float/40) else importance end)'; + if ($aSearch['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)'; + } if ($this->sViewboxSmallSQL) $sImportanceSQL .= " * case when ST_Contains($this->sViewboxSmallSQL, centroid) THEN 1 ELSE 0.5 END"; if ($this->sViewboxLargeSQL) $sImportanceSQL .= " * case when ST_Contains($this->sViewboxLargeSQL, centroid) THEN 1 ELSE 0.5 END"; + $aOrder[] = "$sImportanceSQL DESC"; if (sizeof($aSearch['aFullNameAddress'])) {