mysql全文索引(三)查詢擴充

來源:互聯網
上載者:User

標籤:after   資料   blog   body   mat   from   查詢   exe   logs   

  1. 查詢擴充原理:
    1. 開啟查詢擴充(query expansion)時候,進行兩次查詢,第一次,查出使用者給定的關鍵詞對應的記錄;第二次,用第一次查出的結果裡的關鍵詞,再去查一次,把兩次的結果返回給使用者
  2. 實驗
    1. 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的記錄全部被返回

  3.  注意:

    1. 運用這個功能,可能會搜到很多不相關的資訊,因此,只有當keyword比較short的時候,才使用
  4. 參考資料:https://dev.mysql.com/doc/refman/5.7/en/fulltext-query-expansion.html

mysql全文索引(三)查詢擴充

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.