开发者

MySQL Search features such as - and +

开发者 https://www.devze.com 2022-12-29 19:18 出处:网络
Lets say I\'m searching the field title, how would I set it up so you could use + and - on keyword开发者_如何转开发s on an SQL level?Welcome to the world of Full-text searches, especially boolean sear

Lets say I'm searching the field title, how would I set it up so you could use + and - on keyword开发者_如何转开发s on an SQL level?


Welcome to the world of Full-text searches, especially boolean searches.

Slightly modified example from the manual:

SELECT * FROM articles WHERE MATCH (title) 
AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);

you don't even need to create a FULLTEXT index for these kinds of searches but it is very recommended.

0

精彩评论

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

关注公众号