Hi David,
Just wondering if its possible to change the search function to allow results for mispellings or partially spelled words.
Example
One of the products in my feed is Grand Theft Auto IV
If someone types in Gran Thef the product won't appear.
Can you suggest any way to correct this so search displays results for words similar to mis-spelled words.
Thanks
Adrian
Thanks David,
Will go with your suggestion. I remember seeing a post here a good while ago about finding out what people are searching for (what they type into the search box). Have had a quick look and can't find it. Would you have a link to this?
Hi,
It's probably this thread you want to start with - it's based around generating a Google sitemap of the exact search terms people are using, but you don't have to go as far as creating the sitemap file, once you have added the database table and logging code in search.php you can then simply browse the table using something like phpMyAdmin to view what people are searching for on your site...
http://www.pricetapestry.com/node/822
Cheers,
David.
Hi Adrian,
"Sounds like" search is extremely complex i'm afraid and not something that is supported natively by MySQL's full text indexing method, or PHP i'm afraid. There are functions that can help with such a feature (soundex() for example) but then you're up against performance issues.
The only thing I can suggest is if you are aware of very common mis-spellings on your site - perhaps gleaned from studying access logs, and that would be to add words to the search term in search.php if the mis-spelt words are present. If you look for the following code (approx. line 66):
foreach($words as $word)
{
... you could add something like this on the next line:
if (strtolower($word)=="gran") $parts[0] .= " grand ";
if (strtolower($word)=="thef") $parts[0] .= " theft ";
Simply add as many lines as required to support the mis-spellings you are expecting on your site.
Cheers,
David.