Forum Moderators: coopster
For example: I have a database that has a bunch of product keywords in it like this:
red widgets, green widgets, big red widgets, small red widgets
What I'm trying to do is figure out a way that if someone types into my search box, "red widgets" that they get the result for "red widgets" AND the result for "small red widgets". But I also want to show search results if they type in "expensive widgets" such that "expensive red widgets" shows up, also.
Now, I know that I can take the search string and parse it into individual words and put the words in various orders, etc and then do a foreach to loop through this list to see if any category descriptors match any combination of words (including combinations of words that are shorter and/or longer as far as number of words than the original search query)...but is there a better way of doing this than that (particularly without using LIKE because LIKE is giving me too many results that are not targted enough)?
Thanks!
What I'm trying to do is figure out a way that if someone types into my search box, "red widgets" that they get the result for "red widgets" AND the result for "small red widgets". But I also want to show search results if they type in "expensive widgets" such that "expensive red widgets" shows up, also.
If you're using MySQL, you might consider using it's "Full-Text Search" functions:
[dev.mysql.com...]
-- Roger