From: Sarah Hoffmann Date: Mon, 10 Mar 2014 23:32:54 +0000 (+0100) Subject: allow US state name abbreviations at beginning of search term X-Git-Tag: v2.3.0~65 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/a92907186b2acc6e2074c0db270de49e9f266a9d?ds=inline allow US state name abbreviations at beginning of search term fixes https://trac.openstreetmap.org/ticket/5136 --- diff --git a/lib/Geocode.php b/lib/Geocode.php index 8d3ae79a..f87748c3 100644 --- a/lib/Geocode.php +++ b/lib/Geocode.php @@ -483,9 +483,9 @@ // Conflicts between US state abreviations and various words for 'the' in different languages if (isset($this->aLangPrefOrder['name:en'])) { - $sQuery = preg_replace('/,\s*il\s*(,|$)/',', illinois\1', $sQuery); - $sQuery = preg_replace('/,\s*al\s*(,|$)/',', alabama\1', $sQuery); - $sQuery = preg_replace('/,\s*la\s*(,|$)/',', louisiana\1', $sQuery); + $sQuery = preg_replace('/(^|,)\s*il\s*(,|$)/','\1illinois\2', $sQuery); + $sQuery = preg_replace('/(^|,)\s*al\s*(,|$)/','\1alabama\2', $sQuery); + $sQuery = preg_replace('/(^|,)\s*la\s*(,|$)/','\1louisiana\2', $sQuery); } // View Box SQL