I have a search script on my site now using LIKE with wildcards on either side. The problem is that if someone searches on "APHS" which is a type of film, anything with the word photogrAPHS comes up too.
Obviously because the pattern matches. However if I take off the wildcards it wont find it because its not the first word of the string.
Anyone have anything thoughts on how to go about that? So that if you search on APHS is searches the whole field to see if there is a word match?
thanks!
Search question - how to get specific
Moderator: General Moderators
-
JPlush76
- Forum Regular
- Posts: 819
- Joined: Thu Aug 01, 2002 5:42 pm
- Location: Los Angeles, CA
- Contact:
no its not the only word that is the problem it was just an example.
aphs is not always capital, just another example.
lets say I have a sentence "kodak films are great dude"
customer searches on "kodak film"
I'd want that product to come up because it contains kodak and film. I'd like to match words from start to end, having the end a wildcard IE LIKE $word%
the problem with that is if I use like its only checking the first word.
aphs is not always capital, just another example.
lets say I have a sentence "kodak films are great dude"
customer searches on "kodak film"
I'd want that product to come up because it contains kodak and film. I'd like to match words from start to end, having the end a wildcard IE LIKE $word%
the problem with that is if I use like its only checking the first word.
check out http://www.mysql.com/doc/en/Regexp.html
maybe you like it
but of course it slows down the query
maybe you like it
but of course it slows down the query