]> git.openstreetmap.org Git - nominatim.git/commitdiff
downgrade housenumbers without numbers
authorSarah Hoffmann <lonvia@denofr.de>
Sun, 24 Feb 2019 13:39:14 +0000 (14:39 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Sun, 24 Feb 2019 13:39:14 +0000 (14:39 +0100)
Fixes #1312.

lib/SearchDescription.php

index bf32df9642e40a9fd03edae98f0554079bd86d29..f5179ce1b4d786ae94f1752d4e47e71eb73c3dc4 100644 (file)
@@ -237,7 +237,8 @@ class SearchDescription
                 $oSearch->sHouseNumber = $oSearchTerm->sToken;
                 // sanity check: if the housenumber is not mainly made
                 // up of numbers, add a penalty
-                if (preg_match_all('/[^0-9]/', $oSearch->sHouseNumber, $aMatches) > 2) {
+                if (preg_match('/\\d/', $oSearch->sHouseNumber) === 0
+                    || preg_match_all('/[^0-9]/', $oSearch->sHouseNumber, $aMatches) > 2) {
                     $oSearch->iSearchRank++;
                 }
                 if (empty($oSearchTerm->iId)) {