| 1 | | for mysql, we need MYISAM |
| | 1 | for mysql, we need MyISAM tables |
| | 2 | |
| | 3 | e.g. |
| | 4 | mysql> CREATE TABLE articles ( |
| | 5 | -> id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, |
| | 6 | -> title VARCHAR(200), |
| | 7 | -> body TEXT, |
| | 8 | -> FULLTEXT (title,body) |
| | 9 | -> ); |
| | 10 | |
| | 11 | example query: |
| | 12 | mysql> SELECT * FROM articles |
| | 13 | -> WHERE MATCH (title,body) AGAINST ('database'); |
| | 14 | |
| | 15 | |
| | 16 | Hints from MySQL documentation: |
| | 17 | |
| | 18 | Loading data into a table that has an existing FULLTEXT index |
| | 19 | could be significantly slower. |
| | 20 | |
| | 21 | For large datasets, it is much faster to load your data into |
| | 22 | a table that has no FULLTEXT index, then create the index |
| | 23 | with ALTER TABLE (or CREATE INDEX) |