]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/Geocode.php
sanity check of house number format
[nominatim.git] / lib / Geocode.php
index 92e1a0b327d2b295bc6210427bc28af3eaa12d0e..847439c76e5d3712ed3d4068b78ca2d3c319c20d 100644 (file)
                                                                                                if ($aSearch['sHouseNumber'] === '')
                                                                                                {
                                                                                                        $aSearch['sHouseNumber'] = $sToken;
+                                                    // 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']++;
                                                                                                        if ($aSearch['iSearchRank'] < $this->iMaxRank) $aNewWordsetSearches[] = $aSearch;
                                                                                                        /*
                                                                                                        // Fall back to not searching for this item (better than nothing)