mysql的全文检索的方法

原文章地址文章不错:mysql5.6版本以上支持全文搜索;以项目中表为例子

首先对表的一列创建全文检索的索引

alert table jc_content_txt add fulltext jct_txt_ft(txt);

查询例如

select t.content_id ,t.txt from jc_content_txt t where match(txt) against('对重大典型案件继续实行挂牌督办和公开通报'in boolean mode) order by t.content_id  ;

查询的效率相比

select t.content_id ,t.txt from jc_content_txt t where t.txt like "%对重大典型案件继续实行挂牌督办和公开通报'%" order by t.content_id;

快的多;


你可能感兴趣的:(java开发)