]> git.openstreetmap.org Git - nominatim.git/commitdiff
be more strict with us state replacement hack
authorSarah Hoffmann <lonvia@denofr.de>
Mon, 25 Jun 2012 06:46:14 +0000 (08:46 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Mon, 25 Jun 2012 06:46:14 +0000 (08:46 +0200)
replace il/al/la only if they are properly separated by a comma

website/search.php

index 71041080a1fb440adb7b1462c3cc5e3a8535d082..646eefe6a07fcaff6c0106918e3ee4bed88518a5 100755 (executable)
                 $sQuery = str_ireplace(array('New York, ny','new york, new york', 'New York ny','new york new york'), 'new york city, ny', $sQuery);
                if (isset($aLangPrefOrder['name:en']))          
                {
-                       $sQuery = preg_replace('/\\bil\\b/','illinois', $sQuery);
-                       $sQuery = preg_replace('/\\bal\\b/','alabama', $sQuery);
-                       $sQuery = preg_replace('/\\bla\\b/','louisiana', $sQuery);
-                       $sQuery = preg_replace('/\\bde louisiana\\b/','de la', $sQuery);
+                       $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);
                }
 
                // If we have a view box create the SQL