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:
Sarah Hoffmann 2014-05-01 09:18:10 +02:00
parent 34adfd5041
commit ac70726591

View File

@ -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)