使用MySQL全文匹配两个字段以查找相关结果?

时间:2014-03-29 06:47:28

标签: mysql sql search full-text-search

我有一个包含两个字段的博客表:

title  <--- plain text
body   <--- html format

鉴于博客记录,如何在全文查询中同时使用标题和正文来查找相关的博客帖子?

1 个答案:

答案 0 :(得分:1)

试试:

  select *, MATCH (title, body) AGAINST ('some words' IN BOOLEAN MODE) as searched from table where MATCH(`title`, `body`) AGAINST('some words'  IN BOOLEAN MODE)DESC