• MySQL -- 全文检索(查询扩展检索)


    通常用在查询的关键词太短,用户需要隐含知识进行扩展。例如,查单词database时,用户可能还希望不仅仅包含database的文档,可能还指包含mysql、oracle、db2等单词。这时就需要查询扩展。

    使用"with query expansion"或"in natural language mode with query expansion"关键语法就可以开启自动相关性反馈。共有两个阶段:
    1.根据检索的单词进行全文检索
    2.根据第一阶段产生的分词在进行一次全文检索,找出与第一阶段相关性比较高的单词

    mysql> SELECT * 
        -> FROM  articles
        -> WHERE
        ->     MATCH (title , body) AGAINST ('database' IN NATURAL LANGUAGE MODE);
    +----+-------------------+------------------------------------------+
    | id | title             | body                                     |
    +----+-------------------+------------------------------------------+
    |  5 | MySQL vs. YourSQL | In the following database comparison ... |
    |  7 | MySQL Tutorial    | DBMS stands for DataBase ...             |
    +----+-------------------+------------------------------------------+
    2 rows in set (0.00 sec)
    
    mysql> SELECT  *
        -> FROM  articles
        -> WHERE
        ->     MATCH (title , body) AGAINST ('database' WITH QUERY EXPANSION);
    +----+-----------------------+------------------------------------------------------------------+
    | id | title                 | body                                                             |
    +----+-----------------------+------------------------------------------------------------------+
    |  5 | MySQL vs. YourSQL     | In the following database comparison ...                         |
    |  7 | MySQL Tutorial        | DBMS stands for DataBase ...                                     |
    |  8 | Oracle Tutorial       | DBMS stands for you to test DB ...                               |
    |  6 | MySQL Security        | When configured properly, MySQL ...                              |
    |  3 | Optimizing MySQL      | In this tutorial we will show ...                                |
    |  2 | How To Use MySQL Well | After you went through a ...                                     |
    |  4 | 1001 MySQL Tricks     | 1. Never run mysqld as root. 2. ...                              |
    | 11 | Python Tutorial       | pthon is ab1 bc2 cd3 de4 ef5 fg6 gh7 hi8 ij9 jk10 kl11 lm12 mn13 |
    | 12 | BOOLEN Tutorial       | word1,word2,word3,word4,word5,word6,word7,word8,word9,word10     |
    +----+-----------------------+------------------------------------------------------------------+
    9 rows in set (0.00 sec)
    
    mysql> 
    

      

    由于查询扩展可能带来许多非相关性的查询,建议谨慎使用!

  • 相关阅读:
    数据处理之求和语句,retain语句
    Day1 Excel基本知识
    Day6 数据清洗(2)
    Day5 数据的清洗
    Day5 快速输入数据的方法(2)
    Day5 快速输入数据的方法
    Day4 利用小技巧进行快速数据处理
    Day3 Excel与数据分析之小技巧
    Day2 Excel与数据处理之定位条件、选择性粘贴及查找功能
    day5:python学习之集合
  • 原文地址:https://www.cnblogs.com/abclife/p/7519579.html
Copyright © 2020-2023  润新知