mirror of
https://github.com/osm-search/Nominatim.git
synced 2024-12-26 06:22:13 +03:00
sanity check of house number format
Add a penalty for house number search terms when they contain too many non-numeric characters in an attempt to filter tokens that ended up as house numbers in the word table as a result of mapping errors.
This commit is contained in:
parent
34adfd5041
commit
ac70726591
@ -890,6 +890,9 @@
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user