MySQL Full-Text Search Boolean search

Source: Internet
Author: User

Using in Boolean mode to modify the program, MySQL can also perform Boolean Full-text search:

mysql> SELECT * FROM articles WHERE MATCH (title,body)
  -> AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
+----+-----------------------+-------------------------------------+
| id | title         | body                |
+----+-----------------------+-------------------------------------+
| 1 | MySQL Tutorial    | DBMS stands for DataBase ...    |
| 2 | How To Use MySQL Well | After you went through a ...    |
| 3 | Optimizing MySQL   | In this tutorial we will show ...  |
| 4 | 1001 MySQL Tricks   | 1. Never run mysqld as root. 2. ... |
| 6 | MySQL Security    | When configured properly, MySQL ... |
+----+-----------------------+-------------------------------------+

This query retrieves all the rows containing the word "MySQL", but does not retrieve the line containing the word "yoursql".

Boolean Full-text search has the following characteristics:

They do not use a 50%-field value.

They do not categorize rows in the order in which they are in a weak correlation. You can see this in the above query results: The most relevant row is a row that contains two "MySQL", but it is listed in the final position, not the beginning position.

Even if there are no fulltext, they can still work, even though the search execution in this way is very slow.

The minimum word length full-text parameter and the maximum word length full-text parameter are applicable.

The Stop word applies.

The performance of Boolean Full-text search supports the following operators:

+

A leading plus sign indicates that the word must appear at the beginning of each row returned.

--

A leading minus sign indicates that the word must not appear in any returned rows.

(no operator)

In the default state (when no + or – is specified), the word is optional, but has a higher row level that contains the word. This and match () ... Against () does not use in BOOLEAN mode to modify a program in a similar operation.

> <

These two operators are used to change the effect of a word on the associated value assigned to a row. The > operator enhances its impact, while the < operator weakens its impact. See the example below.

()

Parentheses are used to divide words into child expressions. The enclosed brackets can be nested.

~

A leading tilde is used as a negative character to negate the effect of a word on the row's relevance. This is useful for words that mark "noise (useless information)." The rows containing such words are lower than other rows, but they may be used concurrently with the-number, so that no useless information rows are dispatched at any time.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.