Jump to content

MySQL "contains" search?


meman1188

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/116478-mysql-contains-search/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.