首页 > 数据库技术 > 详细

[MySQL] 原生全文检索 fulltext 的简单应用

时间:2021-02-16 18:13:03      阅读:24      评论:0      收藏:0      [点我收藏+]

 

在目标字段上添加全文检索:alter table 表名 add fulltext(字段) with parser ngram

 

查询语句:select * from xxx where match(字段) against (‘检索词‘ in natural language mode)

 

多字段和多个词检索:select * from xxx where match(字段1, 字段2) against (‘检索词1 检索词2‘ in natural language mode)

检索词之间空格隔开代表 或 查询。

 

ngram全文检索插件支持中文分词,当然也可以外部程序分词后再进行查询。

 

Doc:https://dev.mysql.com/doc/refman/8.0/en/fulltext-natural-language.html

Link:https://www.cnblogs.com/farwish/p/14406662.html

[MySQL] 原生全文检索 fulltext 的简单应用

原文:https://www.cnblogs.com/farwish/p/14406662.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!