最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

MySQL全文檢索的實現(xiàn)示例

 更新時間:2024年04月18日 08:41:06   作者:Q小白養(yǎng)成記  
全文搜索是一種在文本字段中查找關(guān)鍵詞的功能。在MySQL中,我們可以使用全文搜索來提高查詢的效率,本文主要介紹了MySQL全文檢索的實現(xiàn)示例,具有一定的參考價值,感興趣的可以了解一下

不是所有的數(shù)據(jù)表都支持全文檢索 MySQL支持多種底層數(shù)據(jù)庫引擎,但是并非所有的引擎支持全文檢索 ,目前最常用引擎是是MyISAM和InnoDB;前者支持全文檢索,后者不支持。

booolean模式操作符

操作符含義
+必須有
-必須不包含
>包含對應(yīng)關(guān)鍵字的排名靠前
<包含對應(yīng)關(guān)鍵字的排名靠后
~取反()
*放在詞尾 類似通配符
" "引號中間作為一個完整的值處理

實驗: 

表productnotes :

1.查詢包含rabbit的行,并按照相關(guān)性排序

mysql> SELECT note_text
    -> FROM productnotes
    -> WHERE Match(note_text) Against('rabbit');
+----------------------------------------------------------------------------------------------------------------------+
| note_text                                                                                                            |
+----------------------------------------------------------------------------------------------------------------------+
| Customer complaint: rabbit has been able to detect trap, food apparently less effective now.                         |
| Quantity varies, sold by the sack load. All guaranteed to be bright and orange, and suitable for use as rabbit bait. |
+----------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.01 sec)

 2.顯示每一條的相關(guān)性值

mysql> SELECT note_text,
    ->  Match(note_text) Against('rabbit') AS match_rank
    -> FROM productnotes;
+-----------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------+
| note_text                                                                                                                                                 | match_rank         |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------+
| Customer complaint:
Sticks not individually wrapped, too easy to mistakenly detonate all at once.
Recommend individual wrapping.                          |                  0 |
| Can shipped full, refills not available.
Need to order new can if refill needed.                                                                          |                  0 |
| Safe is combination locked, combination not provided with safe.
This is rarely a problem as safes are typically blown up or dropped by customers.         |                  0 |
| Quantity varies, sold by the sack load.
All guaranteed to be bright and orange, and suitable for use as rabbit bait.                                      | 1.5905543565750122 |
| Included fuses are short and have been known to detonate too quickly for some customers.
Longer fuses are available (item FU1) and should be recommended. |                  0 |
| Matches not included, recommend purchase of matches or detonator (item DTNTR).                                                                            |                  0 |
| Please note that no returns will be accepted if safe opened using explosives.                                                                             |                  0 |
| Multiple customer returns, anvils failing to drop fast enough or falling backwards on purchaser. Recommend that customer considers using heavier anvils.  |                  0 |
| Item is extremely heavy. Designed for dropping, not recommended for use with slings, ropes, pulleys, or tightropes.                                       |                  0 |
| Customer complaint: rabbit has been able to detect trap, food apparently less effective now.                                                              | 1.6408053636550903 |
| Shipped unassembled, requires common tools (including oversized hammer).                                                                                  |                  0 |
| Customer complaint:
Circular hole in safe floor can apparently be easily cut with handsaw.                                                                |                  0 |
| Customer complaint:
Not heavy enough to generate flying stars around head of victim. If being purchased for dropping, recommend ANV02 or ANV03 instead.   |                  0 |
| Call from individual trapped in safe plummeting to the ground, suggests an escape hatch be added.
Comment forwarded to vendor.                            |                  0 |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------+
14 rows in set (0.00 sec)

3.有heavy 但是沒有rope

mysql> SELECT note_text
    -> FROM productnotes
    -> WHERE Match(note_text)
    ->  Against('heavy -rope*' IN BOOLEAN MODE);
+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| note_text                                                                                                                                               |
+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| Customer complaint:
Not heavy enough to generate flying stars around head of victim. If being purchased for dropping, recommend ANV02 or ANV03 instead. |
+---------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

到此這篇關(guān)于MySQL 全文檢索的文章就介紹到這了,更多相關(guān)MySQL 全文檢索內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家! 

相關(guān)文章

最新評論

叶城县| 建昌县| 千阳县| 连云港市| 青神县| 射洪县| 余庆县| 旺苍县| 湛江市| 宝清县| 河西区| 喀喇| 清涧县| 略阳县| 宾川县| 西充县| 洛阳市| 敖汉旗| 合江县| 克什克腾旗| 涿鹿县| 阜城县| 云阳县| 卓资县| 博罗县| 萝北县| 永善县| 察雅县| 正阳县| 伊宁市| 梅州市| 沁水县| 邹城市| 朝阳市| 六安市| 宁德市| 淄博市| 巴中市| 平度市| 湘西| 峨眉山市|