meman1188 Posted July 24, 2008 Share Posted July 24, 2008 I'm trying to pull certain phrases out of search queries that users enter. For example, if the search query is "Bill Gates turns 52", I would like to catch "Bill Gates" which is an entry in the MySql table `topics` under the column `topic`. So how do I preform this type of search on the table.. something like "Search Query" CONTAINS (`topic`). It is not a wildcard search (%Search Query%) because the query is bigger than the value in the DB and full text does not work because I want exact matches to the topic name in the database. Thanks for the help Quote Link to comment Share on other sites More sharing options...
mbeals Posted July 24, 2008 Share Posted July 24, 2008 take a look at full text searching. it will do what you want Quote Link to comment Share on other sites More sharing options...
meman1188 Posted July 24, 2008 Author Share Posted July 24, 2008 The problem with full text is it will return partial matches. For example, "Bill must cross the gates" is not the same as "bill gates", but will be returned in a full text search, not to mention partial results like "bill throws the ball" would cause results also. I can't put the whole search query in quotes, cause i don't want to match the whole thing, just part of it, and I can't think of any way to determine which part should be in quotes, programmatically. And to solve the partial problem, i could put "+" on the terms, but i don't want all the words to be present, just the one that make up the topic name. Quote Link to comment Share on other sites More sharing options...
fenway Posted July 26, 2008 Share Posted July 26, 2008 You'd have to break up the user query into part and search for exact matches... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.