Author: paul
Date: 2006-02-15 21:18:29 +0100 (Wed, 15 Feb 2006)
New Revision: 1338
Log:
r3155@kite-hub: paul | 2006-02-15 14:17:40 -0600
Revise intro to full-text section.
Document new fulltext search modifiers.
Modified:
trunk/
trunk/refman-4.1/functions.xml
trunk/refman-5.0/functions.xml
trunk/refman-5.1/functions.xml
trunk/refman-common/news-5.1.xml
Property changes on: trunk
___________________________________________________________________
Name: svk:merge
- b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:7578
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:3153
+ b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:7578
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:3155
Modified: trunk/refman-4.1/functions.xml
===================================================================
--- trunk/refman-4.1/functions.xml 2006-02-15 19:29:46 UTC (rev 1337)
+++ trunk/refman-4.1/functions.xml 2006-02-15 20:18:29 UTC (rev 1338)
@@ -9034,9 +9034,9 @@
<remark role="help-syntax"/>
<programlisting>
-MATCH
(<replaceable>col1</replaceable>,<replaceable>col2</replaceable>,...)
AGAINST (<replaceable>expr</replaceable>
[<replaceable>search_mode</replaceable>])
+MATCH
(<replaceable>col1</replaceable>,<replaceable>col2</replaceable>,...)
AGAINST (<replaceable>expr</replaceable>
[<replaceable>search_modifier</replaceable>])
-<replaceable>search_mode:</replaceable> { IN BOOLEAN MODE | WITH QUERY
EXPANSION }
+<replaceable>search_modifier:</replaceable> { IN BOOLEAN MODE | WITH QUERY
EXPANSION }
</programlisting>
<remark role="help-description-begin"/>
@@ -9088,32 +9088,50 @@
Full-text searching is performed using <literal>MATCH() ...
AGAINST</literal> syntax. <literal>MATCH()</literal> takes a
comma-separated list that names the columns to be searched.
- <literal>AGAINST</literal> takes a string to search for, and
- optionally a search mode. The search string must be a literal
- string, not a variable or a column name. There are three search
- modes:
+ <literal>AGAINST</literal> takes a string to search for, and an
+ optional modifier that indicates what type of search to perform.
+ The search string must be a literal string, not a variable or a
+ column name. There are three types of full-text searches:
</para>
<itemizedlist>
<listitem>
<para>
- Boolean mode, specified with <literal>IN BOOLEAN
- MODE</literal>.
+ A boolean search interprets the search string using the rules
+ of a special query language. The string contains the words to
+ search for. It can also contain operators that specify
+ requirements such that a word must be present or absent in
+ matching rows, or that it should be weighted higher or lower
+ than usual. Common words such as <quote>some</quote> or
+ <quote>then</quote> are stopwords and do not match if present
+ in the search string. The <literal>IN BOOLEAN MODE</literal>
+ modifier specifies a boolean search. For more information, see
+ <xref linkend="fulltext-boolean"/>.
</para>
</listitem>
<listitem>
<para>
- Natural language mode. Full-text searches use natural language
- mode if no mode is given..
+ A natural language search interprets the search string as a
+ phrase in natural human language (a phrase in free text).
+ There are no special operators. The stopword list applies. In
+ addition, words that are present in more than 50% of the rows
+ are considered common and do not match. Full-text searches are
+ natural language searches if no modifier is given.
</para>
</listitem>
<listitem>
<para>
- Natural language mode with query expansion, specified with
- <literal>WITH QUERY EXPANSION</literal>.
+ A query expansion search is a modification of a natural
+ language search. The search string is used to perform a
+ natural language search. Then words from the most relevant
+ rows returned by the search are added to the search string and
+ the search is done again. The query returns the rows from the
+ second search. The <literal>WITH QUERY EXPANSION</literal>
+ modifier specifies a query expansion search. For more
+ information, see <xref linkend="fulltext-query-expansion"/>.
</para>
</listitem>
@@ -9122,11 +9140,6 @@
<remark role="help-description-end"/>
<para>
- These search modes are described in more detail in the following
- discussion.
- </para>
-
- <para>
Constraints on full-text searching are listed in
<xref linkend="fulltext-restrictions"/>.
</para>
Modified: trunk/refman-5.0/functions.xml
===================================================================
--- trunk/refman-5.0/functions.xml 2006-02-15 19:29:46 UTC (rev 1337)
+++ trunk/refman-5.0/functions.xml 2006-02-15 20:18:29 UTC (rev 1338)
@@ -9144,9 +9144,9 @@
<remark role="help-syntax"/>
<programlisting>
-MATCH
(<replaceable>col1</replaceable>,<replaceable>col2</replaceable>,...)
AGAINST (<replaceable>expr</replaceable>
[<replaceable>search_mode</replaceable>])
+MATCH
(<replaceable>col1</replaceable>,<replaceable>col2</replaceable>,...)
AGAINST (<replaceable>expr</replaceable>
[<replaceable>search_modifier</replaceable>])
-<replaceable>search_mode:</replaceable> { IN BOOLEAN MODE | WITH QUERY
EXPANSION }
+<replaceable>search_modifier:</replaceable> { IN BOOLEAN MODE | WITH QUERY
EXPANSION }
</programlisting>
<remark role="help-description-begin"/>
@@ -9197,32 +9197,50 @@
Full-text searching is performed using <literal>MATCH() ...
AGAINST</literal> syntax. <literal>MATCH()</literal> takes a
comma-separated list that names the columns to be searched.
- <literal>AGAINST</literal> takes a string to search for, and
- optionally a search mode. The search string must be a literal
- string, not a variable or a column name. There are three search
- modes:
+ <literal>AGAINST</literal> takes a string to search for, and an
+ optional modifier that indicates what type of search to perform.
+ The search string must be a literal string, not a variable or a
+ column name. There are three types of full-text searches:
</para>
<itemizedlist>
<listitem>
<para>
- Boolean mode, specified with <literal>IN BOOLEAN
- MODE</literal>.
+ A boolean search interprets the search string using the rules
+ of a special query language. The string contains the words to
+ search for. It can also contain operators that specify
+ requirements such that a word must be present or absent in
+ matching rows, or that it should be weighted higher or lower
+ than usual. Common words such as <quote>some</quote> or
+ <quote>then</quote> are stopwords and do not match if present
+ in the search string. The <literal>IN BOOLEAN MODE</literal>
+ modifier specifies a boolean search. For more information, see
+ <xref linkend="fulltext-boolean"/>.
</para>
</listitem>
<listitem>
<para>
- Natural language mode. Full-text searches use natural language
- mode if no mode is given..
+ A natural language search interprets the search string as a
+ phrase in natural human language (a phrase in free text).
+ There are no special operators. The stopword list applies. In
+ addition, words that are present in more than 50% of the rows
+ are considered common and do not match. Full-text searches are
+ natural language searches if no modifier is given.
</para>
</listitem>
<listitem>
<para>
- Natural language mode with query expansion, specified with
- <literal>WITH QUERY EXPANSION</literal>.
+ A query expansion search is a modification of a natural
+ language search. The search string is used to perform a
+ natural language search. Then words from the most relevant
+ rows returned by the search are added to the search string and
+ the search is done again. The query returns the rows from the
+ second search. The <literal>WITH QUERY EXPANSION</literal>
+ modifier specifies a query expansion search. For more
+ information, see <xref linkend="fulltext-query-expansion"/>.
</para>
</listitem>
@@ -9231,11 +9249,6 @@
<remark role="help-description-end"/>
<para>
- These search modes are described in more detail in the following
- discussion.
- </para>
-
- <para>
Constraints on full-text searching are listed in
<xref linkend="fulltext-restrictions"/>.
</para>
Modified: trunk/refman-5.1/functions.xml
===================================================================
--- trunk/refman-5.1/functions.xml 2006-02-15 19:29:46 UTC (rev 1337)
+++ trunk/refman-5.1/functions.xml 2006-02-15 20:18:29 UTC (rev 1338)
@@ -9088,9 +9088,15 @@
<remark role="help-syntax"/>
<programlisting>
-MATCH
(<replaceable>col1</replaceable>,<replaceable>col2</replaceable>,...)
AGAINST (<replaceable>expr</replaceable>
[<replaceable>search_mode</replaceable>])
+MATCH
(<replaceable>col1</replaceable>,<replaceable>col2</replaceable>,...)
AGAINST (<replaceable>expr</replaceable>
[<replaceable>search_modifier</replaceable>])
-<replaceable>search_mode:</replaceable> { IN BOOLEAN MODE | WITH QUERY
EXPANSION }
+<replaceable>search_modifier:</replaceable>
+ {
+ IN BOOLEAN MODE
+ | IN NATURAL LANGUAGE MODE
+ | IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION
+ | WITH QUERY EXPANSION
+ }
</programlisting>
<remark role="help-description-begin"/>
@@ -9141,44 +9147,66 @@
Full-text searching is performed using <literal>MATCH() ...
AGAINST</literal> syntax. <literal>MATCH()</literal> takes a
comma-separated list that names the columns to be searched.
- <literal>AGAINST</literal> takes a string to search for, and
- optionally a search mode. The search string must be a literal
- string, not a variable or a column name. There are three search
- modes:
+ <literal>AGAINST</literal> takes a string to search for, and an
+ optional modifier that indicates what type of search to perform.
+ The search string must be a literal string, not a variable or a
+ column name. There are three types of full-text searches:
</para>
<itemizedlist>
<listitem>
<para>
- Boolean mode, specified with <literal>IN BOOLEAN
- MODE</literal>.
+ A boolean search interprets the search string using the rules
+ of a special query language. The string contains the words to
+ search for. It can also contain operators that specify
+ requirements such that a word must be present or absent in
+ matching rows, or that it should be weighted higher or lower
+ than usual. Common words such as <quote>some</quote> or
+ <quote>then</quote> are stopwords and do not match if present
+ in the search string. The <literal>IN BOOLEAN MODE</literal>
+ modifier specifies a boolean search. For more information, see
+ <xref linkend="fulltext-boolean"/>.
</para>
</listitem>
<listitem>
<para>
- Natural language mode. Full-text searches use natural language
- mode if no mode is given..
+ A natural language search interprets the search string as a
+ phrase in natural human language (a phrase in free text).
+ There are no special operators. The stopword list applies. In
+ addition, words that are present in more than 50% of the rows
+ are considered common and do not match. Full-text searches are
+ natural language searches if the <literal>IN NATURAL LANGUAGE
+ MODE</literal> modifier is given or if no modifier is given.
</para>
</listitem>
<listitem>
<para>
- Natural language mode with query expansion, specified with
- <literal>WITH QUERY EXPANSION</literal>.
+ A query expansion search is a modification of a natural
+ language search. The search string is used to perform a
+ natural language search. Then words from the most relevant
+ rows returned by the search are added to the search string and
+ the search is done again. The query returns the rows from the
+ second search. The <literal>IN NATURAL LANGUAGE MODE WITH
+ QUERY EXPANSION</literal> or <literal>WITH QUERY
+ EXPANSION</literal> modifier specifies a query expansion
+ search. For more information, see
+ <xref linkend="fulltext-query-expansion"/>.
</para>
</listitem>
</itemizedlist>
- <remark role="help-description-end"/>
-
<para>
- These search modes are described in more detail in the following
- discussion.
+ The <literal>IN NATURAL LANGUAGE MODE</literal> and <literal>IN
+ NATURAL LANGUAGE MODE WITH QUERY EXPANSION</literal> modifiers
+ were added in MySQL 5.1.7.
</para>
+ <remark role="help-description-end"/>
+
<para>
Constraints on full-text searching are listed in
<xref linkend="fulltext-restrictions"/>.
@@ -9204,7 +9232,8 @@
Records: 6 Duplicates: 0 Warnings: 0
mysql> <userinput>SELECT * FROM articles</userinput>
- -> <userinput>WHERE MATCH (title,body) AGAINST
('database');</userinput>
+ -> <userinput>WHERE MATCH (title,body)</userinput>
+ -> <userinput>AGAINST ('database' IN NATURAL LANGUAGE
MODE);</userinput>
+----+-------------------+------------------------------------------+
| id | title | body |
+----+-------------------+------------------------------------------+
@@ -9278,18 +9307,19 @@
</para>
<programlisting>
-mysql> <userinput>SELECT id, MATCH (title,body) AGAINST
('Tutorial')</userinput>
+mysql> <userinput>SELECT id, MATCH (title,body)</userinput>
+ -> <userinput>AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) AS
score</userinput>
-> <userinput>FROM articles;</userinput>
-+----+-----------------------------------------+
-| id | MATCH (title,body) AGAINST ('Tutorial') |
-+----+-----------------------------------------+
-| 1 | 0.65545833110809 |
-| 2 | 0 |
-| 3 | 0.66266459226608 |
-| 4 | 0 |
-| 5 | 0 |
-| 6 | 0 |
-+----+-----------------------------------------+
++----+------------------+
+| id | score |
++----+------------------+
+| 1 | 0.65545833110809 |
+| 2 | 0 |
+| 3 | 0.66266459226608 |
+| 4 | 0 |
+| 5 | 0 |
+| 6 | 0 |
++----+------------------+
6 rows in set (0.00 sec)
</programlisting>
@@ -9309,9 +9339,11 @@
<programlisting>
mysql> <userinput>SELECT id, body, MATCH (title,body)
AGAINST</userinput>
- -> <userinput>('Security implications of running MySQL as root') AS
score</userinput>
+ -> <userinput>('Security implications of running MySQL as
root'</userinput>
+ -> <userinput>IN NATURAL LANGUAGE MODE) AS score</userinput>
-> <userinput>FROM articles WHERE MATCH (title,body)
AGAINST</userinput>
- -> <userinput>('Security implications of running MySQL as
root');</userinput>
+ -> <userinput>('Security implications of running MySQL as
root'</userinput>
+ -> <userinput>IN NATURAL LANGUAGE MODE);</userinput>
+----+-------------------------------------+-----------------+
| id | body | score |
+----+-------------------------------------+-----------------+
@@ -9414,7 +9446,8 @@
<programlisting>
mysql> <userinput>SELECT * FROM articles</userinput>
- -> <userinput>WHERE MATCH (title,body) AGAINST
('MySQL');</userinput>
+ -> <userinput>WHERE MATCH (title,body)</userinput>
+ -> <userinput>AGAINST ('MySQL' IN NATURAL LANGUAGE
MODE);</userinput>
Empty set (0.00 sec)
</programlisting>
@@ -9804,8 +9837,9 @@
<para>
Blind query expansion (also known as automatic relevance
feedback) is enabled by adding <literal>WITH QUERY
- EXPANSION</literal> following the search phrase. It works by
- performing the search twice, where the search phrase for the
+ EXPANSION</literal> or <literal>IN NATURAL LANGUAGE MODE WITH
+ QUERY EXPANSION</literal> following the search phrase. It works
+ by performing the search twice, where the search phrase for the
second search is the original search phrase concatenated with
the few most highly relevant documents from the first search.
Thus, if one of these documents contains the word
@@ -9818,7 +9852,8 @@
<programlisting>
mysql> <userinput>SELECT * FROM articles</userinput>
- -> <userinput>WHERE MATCH (title,body) AGAINST
('database');</userinput>
+ -> <userinput>WHERE MATCH (title,body)</userinput>
+ -> <userinput>AGAINST ('database' IN NATURAL LANGUAGE
MODE);</userinput>
+----+-------------------+------------------------------------------+
| id | title | body |
+----+-------------------+------------------------------------------+
Modified: trunk/refman-common/news-5.1.xml
===================================================================
--- trunk/refman-common/news-5.1.xml 2006-02-15 19:29:46 UTC (rev 1337)
+++ trunk/refman-common/news-5.1.xml 2006-02-15 20:18:29 UTC (rev 1338)
@@ -124,6 +124,15 @@
</para>
</listitem>
+ <listitem>
+ <para>
+ Added the <literal>IN NATURAL LANGUAGE MODE</literal> and
+ <literal>IN NATURAL LANGUAGE MODE WITH QUERY
+ EXPANSION</literal> modifiers for full-text searches.
+ See <xref linkend="fulltext-search"/>.
+ </para>
+ </listitem>
+
</itemizedlist>
<para>
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r1338 - in trunk: . refman-4.1 refman-5.0 refman-5.1 refman-common | paul | 15 Feb |