mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-12 05:44:06 +00: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:
@@ -890,6 +890,9 @@
|
|||||||
if ($aSearch['sHouseNumber'] === '')
|
if ($aSearch['sHouseNumber'] === '')
|
||||||
{
|
{
|
||||||
$aSearch['sHouseNumber'] = $sToken;
|
$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;
|
if ($aSearch['iSearchRank'] < $this->iMaxRank) $aNewWordsetSearches[] = $aSearch;
|
||||||
/*
|
/*
|
||||||
// Fall back to not searching for this item (better than nothing)
|
// Fall back to not searching for this item (better than nothing)
|
||||||
|
|||||||
Reference in New Issue
Block a user