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. 全文本布尔操作符
+ 包含,词必须存在
- 排除,词必须不出现
> 包含,而且增加等级值
< 包含,而且减少等级值
() 把词组成子表达式(允许这些子表达式作为一个组被包含、排除、排列等)
~ 取消一个值的排序值
* 词尾的通配符
"" 定义一个短语(与单个词的列表不一样,它匹配整个短语以便包含或排除这个短语)