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. 全文本布爾操作符
+ 包含,詞必須存在
- 排除,詞必須不出現
> 包含,而且增加等級值
< 包含,而且減少等級值
() 把詞組成子表達式(允許這些子表達式作為一個組被包含、排除、排列等)
~ 取消一個值的排序值
* 詞尾的通配符
"" 定義一個短語(與單個詞的清單不一樣,它比對整個短語以便包含或排除這個短語)