]> git.openstreetmap.org Git - nominatim.git/commitdiff
housenumbers may only appear before or after the name
authorSarah Hoffmann <lonvia@denofr.de>
Fri, 6 Oct 2017 19:12:25 +0000 (21:12 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Fri, 6 Oct 2017 19:16:35 +0000 (21:16 +0200)
lib/Geocode.php

index bced2a36a555c2166190f9d0c4d0f5caedd93fd3..d221e672ebc047221ae8f5475ce5a2f5f6249823 100644 (file)
@@ -781,8 +781,8 @@ class Geocode
                                         // sanity check: if the housenumber is not mainly made
                                         // up of numbers, add a penalty
                                         if (preg_match_all("/[^0-9]/", $sToken, $aMatches) > 2) $aSearch['iSearchRank']++;
-                                        // also housenumbers should appear in the first or second phrase
-                                        if ($iPhrase > 1) $aSearch['iSearchRank'] += 1;
+                                        // also must not appear in the middle of the address
+                                        if ($aSearch['aAddress'] || $aSearch['aAddressNonSearch']) $aSearch['iSearchRank'] += 1;
                                         if ($aSearch['iSearchRank'] < $this->iMaxRank) $aNewWordsetSearches[] = $aSearch;
                                         /*
                                         // Fall back to not searching for this item (better than nothing)