]> git.openstreetmap.org Git - nominatim.git/commitdiff
further increase penalty on housenumbers without numbers
authorSarah Hoffmann <lonvia@denofr.de>
Thu, 2 Sep 2021 16:11:49 +0000 (18:11 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Thu, 2 Sep 2021 16:11:49 +0000 (18:11 +0200)
Make the penality dependent on the length of the token:
no penalty for one letter house numbers and increasing one
for more letters.

lib-php/TokenHousenumber.php

index cd60d3ca5620b7851a36736971adf753c6db49f9..f7bdc4713e913d0e466d48779e14a9a0924b0bc5 100644 (file)
@@ -59,7 +59,7 @@ class HouseNumber
         $iSearchCost = 1;
         if (preg_match('/\\d/', $this->sToken) === 0
             || preg_match_all('/[^0-9]/', $this->sToken, $aMatches) > 2) {
         $iSearchCost = 1;
         if (preg_match('/\\d/', $this->sToken) === 0
             || preg_match_all('/[^0-9]/', $this->sToken, $aMatches) > 2) {
-            $iSearchCost++;
+            $iSearchCost += strlen($this->sToken) - 1;
         }
         if (!$oSearch->hasOperator(\Nominatim\Operator::NONE)) {
             $iSearchCost++;
         }
         if (!$oSearch->hasOperator(\Nominatim\Operator::NONE)) {
             $iSearchCost++;