MySQL 에서 제공하는 Full Text Search
MySQL 에서인덱스는 BLOB 나 TEXT 데이터형에는 사용할 수 없었으나 Full Text Search 는
TEXT, VARCHAR ,CHAR 컬럼에 인덱스를 사용 가능하게 해준다.
Syntax
ALTER TABLE table_name ADD FULLTEXT [index_name] (index_col_name, .... ) or
CREATE FULLTEXT INDEX index_name ON table_name (col_name[(length)], ... )
실제로 Query 를 이용할 때는 MATCH()~AGAINST() 를 사용한다.
실제 사용 예
mysql> select locusid, summary from LocusLink where
match(summary) against('"adenocarcinoma cells"' in boolean mode);
*************************** 1. row
***************************
locusid: 14
summary: The gene product is an immunoglobulin-type protein. It is found to be
expressed strongly in endothelial cells, cytotrophoblasts, and poorly
differentiated colon adenocarcinoma cells found in lymphatics. The protein
contains a heparin-binding domain and mediates heparin-sensitive cell adhesion.
*************************** 2. row
***************************
locusid: 25859
summary: This gene is induced by androgen in prostate adenocarcinoma cells.
Transcript variants utilizing alternative polyadenylation signals have been
described in the literature.
2 rows in set (0.00 sec)