MySQL全文检索学习!

-- 需要在my.cnf里面设置一个参数
# full text param init
ft_min_word_len=1

use test;
drop table if exists tnew;
CREATE TABLE `tnew` (
`id`  int NOT NULL primary key ,
`content`  longtext  ,
FULLTEXT INDEX `content` (`content`)
)
ENGINE=MyISAM
CHECKSUM=0
DELAY_KEY_WRITE=0
;

insert into test.tnew
select 1,'DBMS stands for DataBase ...';
insert into test.tnew
select 2,'After you went through a ...';
insert into test.tnew
select 3,'In this tutorial we will show ...';
insert into test.tnew
select 4,'In the following database comparison ...';
insert into test.tnew
select 5,'假如你将一个编入索引的列派给BINARY, MySQL 将不能有效使用这个索引。..';

insert into test.tnew
select 6,'这是一种简单的方式来促使逐字节而不是逐字符的进行列比较。这使得比较区分大小写,即使该列不被定义为 BINARY或 BLOB。BINARY也会产生结尾空白,从而更加显眼..';
insert into test.tnew
select 7,'BINARY影响整个比较;它可以在任何操作数前被给定,而产生相同的结果。';
insert into test.tnew
select 8,'若要使用一个不同的字符集, 替换其在上述语句中的latin1名.';
insert into test.tnew
select 9,'索引';
insert into test.tnew
select 10,'索引集合';
set names 'utf8';

Select * from tnew where MATCH content AGAINST ('mysql');
-- 有记录
Select * from tnew where MATCH content AGAINST ('索引');
-- 只有一条记录   9,'索引'; 
-- 可见mysql的全文索引对中文不支持?google结果,都是在php层面解决lamp中文全文检索的问题,不是在数据库层面解决的!
-- 谁如果知道的,留言下

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值