標籤:after 資料 blog body mat from 查詢 exe logs
- 查詢擴充原理:
- 開啟查詢擴充(query expansion)時候,進行兩次查詢,第一次,查出使用者給定的關鍵詞對應的記錄;第二次,用第一次查出的結果裡的關鍵詞,再去查一次,把兩次的結果返回給使用者
- 實驗
mysql> select id,title,body from articles where match(title,body) against(‘fulltext‘ ) order by id asc;+----+-------------------------+---------------------------------+| id | title | body |+----+-------------------------+---------------------------------+| 8 | MySQL Full-Text Indexes | MySQL fulltext indexes use a .. |+----+-------------------------+---------------------------------+1 row in set (0.00 sec)mysql> select id,title,body from articles where match(title,body) against(‘fulltext‘ with query expansion ) order by id asc;+----+-------------------------+-------------------------------------+| id | title | body |+----+-------------------------+-------------------------------------+| 1 | MySQL Tutorial | This database tutorial ... || 2 | How To Use MySQL | After you went through a ... || 4 | MySQL vs. YourSQL | When comparing databases ... || 5 | MySQL Security | When configured properly, MySQL ... || 7 | 1001 MySQL Tricks | 1. Never run mysqld as root. 2. ... || 8 | MySQL Full-Text Indexes | MySQL fulltext indexes use a .. |+----+-------------------------+-------------------------------------+6 rows in set (0.00 sec)
第一次沒有開啟查詢擴充,只有包含關鍵詞:fulltext的記錄8被查到;第二次,包含mysql,fulltext的記錄全部被返回
注意:
- 運用這個功能,可能會搜到很多不相關的資訊,因此,只有當keyword比較short的時候,才使用
- 參考資料:https://dev.mysql.com/doc/refman/5.7/en/fulltext-query-expansion.html
mysql全文索引(三)查詢擴充