]> git.openstreetmap.org Git - nominatim.git/commitdiff
allow US state name abbreviations at beginning of search term
authorSarah Hoffmann <lonvia@denofr.de>
Mon, 10 Mar 2014 23:32:54 +0000 (00:32 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Mon, 10 Mar 2014 23:32:54 +0000 (00:32 +0100)
fixes https://trac.openstreetmap.org/ticket/5136

lib/Geocode.php

index 8d3ae79aeff5c97612f163506aeb3939e80ff4ac..f87748c3d28bae49588192ea109a64d693380cde 100644 (file)
                        // 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