Previously published an article on SQL Server full-text indexing. Now Log The configuration process for the MySQL full-text index.
Step1: CreateStudentTable
CREATE TABLE ' Student ' (
' ID ' INT (one) not NULL auto_increment,
' Studentname ' VARCHAR (+) not NULL,
' Address ' VARCHAR DEFAULT ' Beijing ',
' Gender ' TINYINT (4) Not NULL,
' Mymoney ' DECIMAL (18,2) DEFAULT NULL,
PRIMARY KEY (' id '),
Fulltext KEY ' studentname ' (' Studentname ')
) Engine=myisam Charset=utf8
STEP2:inserting test Data
INSERT into ' xsh '. ' Student '
(
' Studentname ',
' Address ',
' Gender ',
' Mymoney ')
VALUES (
' Happy Love happy ',
' Beijing ',
1,
1);
Step3: ModifyMy.inifile, restart service
My.ini (Linux is my.cnf ), add a line after [mysqld] Ft_ Min_word_len=1 ", then restart Mysql
Results can be viewed through show VARIABLES like ' Ft_min_word_len '
Step4: Ignore weight query(There is only one piece of data in the table)
MySQL default threshold is 50%, above 'you ' in each document appears, therefore is 100%, only below 50% will appear in the result set. But what if the weights are not taken into account? MySQL provides a Boolean full-text Search (boolean fulltext search)
SELECT * FROM Student
WHERE MATCH (studentname) against (' Love ' in BOOLEAN MODE)
This is only a simple record because the full-text index is based on participle, but MySQL does not support Chinese. Need to achieve @ by plugins or by other means !
Full-text indexing in MySQL