- MySQL Full-Text Search support
- More than 4.0 MySQL MyISAM engine supports full text search, which can be used to support search on a typical small website or blog.
- So how to use, simple look:
- 1. Create a table that specifies the columns that support fulltext
- CREATE TABLE Articles (
- ID INT UNSIGNED auto_increment not NULL PRIMARY KEY,
- Title VARCHAR (200),
- Body TEXT,
- Fulltext (Title,body)
- );
- 2. Insert some data as a test
- INSERT into articles (Title,body) VALUES
- (' MySQL Tutorial ', ' DBMS stands for DataBase ... '),
- (' How to use the MySQL well ', ' after you went through a ... '),
- (' Optimizing MySQL ', ' in this tutorial we'll show ... '),
- (' 1001 MySQL Tricks ', ' 1. Never run mysqld as root. 2 ... '),
- (' MySQL vs. Yoursql ', ' in the following database comparison ... '),
- (' MySQL Security ', ' when configured properly, MySQL ... ');
- 3.select Query fulltext Columns
- SELECT * from articles
- WHERE MATCH (title,body) against (' database ');
- Query Result:
- 5 MySQL vs. Yoursql in the following database comparison ...
- 1 MySQL Tutorial DBMS stands for DataBase ...
- A Boolean statement in a full-text query, +-as with normal search engine syntax
- SELECT * from articles WHERE MATCH (title,body)
- Against (' +mysql-yoursql ' in BOOLEAN MODE);
- InnoDB does not support Fulltext, of course, you can use Http://sphinxsearch.com/sphinx to dump database data to support full-text search.
MySQL Full-Text Search support