For English, MySQL's Fulltext property is quite convenient and efficient to implement full-text retrieval, but there are some things to be aware of in the process of using.
First, we add the Fulltext attribute to the field we need to retrieve (assuming the table is already built):
Sql:
ALTER TABLE TABLE_NAME ADD FULLTEXT index (FILED_1,FILED_2);
Next, query the data:
Sql:
SELECT * FROM table_name WHERE MATCH (filed_1,filed_2) against (' keyword ');
Here is a very important consideration:
MySQL specifies that when the word searched in full-text search is more than half the number of rows that are searched, the word will be searched as common word, which is not displayed. (Specific conditions need to check the information to determine)
So, assuming that there is only one row of data in the table at the time of the test, the returned result is always empty no matter how the query is executed. Do not panic, add a few unknown origin keyword data will have the result ~
Of course, MySQL provides a more powerful filter for query results:
Sql:
SELECT * FROM table_name WHERE MATCH (filed_1,filed_2) against (' +keyword_1-keyword_2 ' in BOOLEAN MODE);
This will return the data containing the keyword_1 , and the data containing the keyword_2 will be filtered out.
? ? ? ? ? ? ? ? Original address: http://www.luoning.me/mysql-fulltext.html
About MySQL Fulltext to implement full-text search considerations