Hi there, thanks for looking at our project.
We have a web site that has listings of cars and trucks for sale. Our search is composed of a basic CGI script, which searches a basic tab-delineated text flatfile database, and returns results into an HTML template.
As an automotive website, we have recently realized that people type in the names of vehicles in different ways. For example, Ford makes a truck called the "F-150", and that's how these vehicles are written in our database. However, many people will type in "F150" when doing a search.
What we need, therefore, is a mod to our CGI script that will check for certain instances, like the one above, and "rewrite" the query so it pulls up the appropriate matches in our database.
So, every search would run through this quick check ... for example, if someone does a search for "Ford F150", the modification which you will make to the script would find "F150" on its internal "watch for" list, and change the string to the corresponding "correct" string, so that the query changes to "Ford F-150".
Here are the strings we would need "watched for" and switched:
input string "F150" becomes query string "F-150"
input string "F250" becomes query string "F-250"
input string "F350" becomes query string "F-350"
input string "VW" becomes query string "Volkswagen"
input string "CX7" becomes query string "CX-7"
Does that make sense?
The mod should be clearly commented, and should not affect any other part of the CGI search script's function. All it should do is watch for the above inputs, and change them as shown above.
I am attaching the script itself so you can take a look. Please let me know if you have any questions. Thanks!