]> 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:50:35 +0000 (08:50 +0200)
replace il/al/la only if they are properly separated by a comma

website/search.php

index f0bcf077513b9017e884de74a7da3c03f948dd13..53314d518ba4feeab8ed0aba669ddf5ff4149d59 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 = 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
                }
 
                // If we have a view box create the SQL