MYSQL入门学习之三:全文本搜索(二)
----------------------------------+
| 5 |0.81339610830754 | This line of proprietary reagents,. containers, a
nd automation tools is designed. for genomics and drugdiscovery .research. |
| 7 |0.76517958501676 | specificities include both alpha–beta and beta–
beta. This line from chromatography .data systems (CDSs) and toLIMS. |
+---------+------------------+--------------------------------------------------
----------------------------------------------------------------------------+
2 rows in set (0.00 sec)
8、查询扩展 www.2cto.com
在使用查询扩展时,MySQL对数据和索引进行两遍扫描来完成搜索。
首先,进行一个基本的全文本搜索,找出与搜索条件匹配的所有行;
其次,MySQL检查这些匹配行并选择所有有用的词;
再次,MySQL再次进行全文本搜索,这次不仅使用原来的条件,而且还使用所有有用的词。
利用查询扩展,能找出可能相关的结果,即使它们并不精确包含所查找的词。
表中的行越多,使用查询扩展返回的结果越好。
查询扩展功能在MySQL4.1.1中引入。
[sql]
mysql> select note_id, Match(note_text) Against('This line')as rank,note_text
-> fromproductnotes
-> where Match(note_text)Against('This line' with query expansion);
+---------+------------------+--------------------------------------------------
----------------------------------------------------------------------------+
| note_id | rank | note_text
|
+---------+------------------+--------------------------------------------------
----------------------------------------------------------------------------+
| 5 | 0.81339610830754| This line of proprietary reagents,. containers, a
nd automation tools is designed. for genomics and drugdiscovery .research. |
| 7 |0.76517958501676 | specificities include both alpha–beta and beta–
beta. This line from chromatography .data systems (CDSs) and toLIMS. |
| 3 | 0 | Human S-100. monoclonal.and polyclonal specifici
ties include both alpha–beta and beta–beta isoforms. |
| 6 | 0 | LimsLink is .designed to interfaceoutput. from c
hromatography .data systems (CDSs) and to LIMS. |
| 1 | 0 | PepTool allows users tostore, manage. analyze, a
nd visualize protein data. |
+---------+------------------+--------------------------------------------------
----------------------------------------------------------------------------+
5 rows in set (0.00 sec)
9、布尔文本搜索(boolean mode)
以布尔方式,可以提供关于如下内容的细节:
要匹配的词; www.2cto.com
要排斥的词;
排列提示;(指定某些词比其他词更重要)
表达式分组;
另外一些内容。
[sql]
mysql> select note_id,note_text
-> fromproductnotes
-> whereMatch(note_text) Against('line' in boolean mode);
+---------+---------------------------------------------------------------------
---------------------------------------------------------+
| note_id | note_text
|
+---------+---------------------------------------------------------------------
---------------------------------------------------------+
| 5 | This line ofproprietary reagents,. containers, and automation tools
is designed. for genomicsand drug discovery .research. |
| 7 | specificitiesinclude both alp