mysql text 搜索_MySQL全文本搜索

1. 全文本搜索

使用全文本搜索

select note_text from productnotes where match(note_text) against('rabbit');

使用like也可以实现

select note_text from productnotes where note_text like '%rabbit%';

全文本搜索扩展查询

没有扩展查询

select note_text from productnotes where match(note_text) against('anvils');

扩展查询

select note_text from productnotes where match(note_text) against('anvils' with query expansion);

布尔文本搜索

select note_text from productnotes where match(note_text) against('heavy' in boolean mode);

包含heavy但不包含任意以rope开始

select note_text from productnotes where match(note_text) against('heavy -rope*' in boolean mode);

1. 全文本搜索使用where match(xxx) against('yyy');

全文本搜索支持在create table时的fulltext()字段

2. 搜索不区分大些写,或者使用binary区分大小写

3. 使用match against有排序(具有较高等级的行优先)

使用like没有排序

4. 全文本搜索扩展查询使用where match(xxx) against('yyy' with query expansion);

查询文本yyy内容,同时查询包含yyy文本的其他内容的关联文本

5. 布尔文本搜索使用where match(xxx) against('yyy' in boolean mode);

支持在create table时不是的fulltext()字段

6. 全文本布尔操作符

+ 包含,词必须存在

- 排除,词必须不出现

> 包含,而且增加等级值

< 包含,而且减少等级值

() 把词组成子表达式(允许这些子表达式作为一个组被包含、排除、排列等)

~ 取消一个值的排序值

* 词尾的通配符

"" 定义一个短语(与单个词的列表不一样,它匹配整个短语以便包含或排除这个短语)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值