开发者

MySQL Full Text Search Boolean Mode Partial Match

开发者 https://www.devze.com 2023-01-03 18:47 出处:网络
I\'ve found boolean mode of MySQL full text search useful, however there are a couple of things I can\'t seem to figure out how to achieve.

I've found boolean mode of MySQL full text search useful, however there are a couple of things I can't seem to figure out how to achieve.

For instance imagine I have a full text column containing the words "Steve's Javascript Tutorial - Part One".

I would like to match this for each of the following searches: "tutorials", "javascript tutorials", "java", "java script", "script"

Imagine that each of those searches is simply assigned to a variable in whatever language may be 开发者_如何学编程being used (I always use PHP).

How could I modify this to make sure that Steve's article is returned on each of those searches?

MATCH (article_title) AGAINST ('"+$variable+"*' IN BOOLEAN MODE)


This is impossible ;)

When you search for "tutorials" the entry will not be found, because the entry in the database is singular and the search term is plural. You should do some form of "word stemming" before inserting the values to the database (and on search).

When you have done this, your expression will work. For searrch terms with more words (spaces) you should add the asterix to every word.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号