My database is searched by City and State. Unfortunately, some cities are correct with 'St. Louis' and 'Saint Louis', or 'Ft. Lauderdale' and 'Fort Lauderdale'. Would there be a way to customize the database so that when someone searches for the abbreviated city (St., Ft.), they would still find the other (Saint, Fort)?
Aug 18, 2003, 7:59 AM
User (107 posts)
Aug 18, 2003, 7:59 AM
Post #3 of 3
Views: 2863
Old thread, but I thought someone might be searching the forums for this like I was recently... I used this code and it seems to work okay. In db.cgi, sub query, right after local (%sortby):
if ($in{'keyword'} eq "st") {
($in{'keyword'} = "St.")
}
else ($in{'keyword'} eq "saint") {
($in{'keyword'} = "St.")
}
St. is what is in the db file. the st and saint are the variations users might be typing in. keyword I think would make this include all fields, but one could change keyword to "city" if one only wanted it to apply to a field called "city"
if ($in{'keyword'} eq "st") {
($in{'keyword'} = "St.")
}
else ($in{'keyword'} eq "saint") {
($in{'keyword'} = "St.")
}
St. is what is in the db file. the st and saint are the variations users might be typing in. keyword I think would make this include all fields, but one could change keyword to "city" if one only wanted it to apply to a field called "city"