match against

match against

Full-Text 在5.6之前 只能用于 MyISAM ,5.6开始 可用于InnoDB

id name

1 张三

2 张四

3 张五

4 李三

5 李四

6 李五

1. Boolead Full-text Searches

说明:

+ AND

- AND NOT

space or

###

select * from table_xxx_user where match(name) against(‘+张 -四 -五’  IN BOOLEAN MODE)

结果:

1 张三

###

select * from table_xxx_user where match(name) against(‘张 四 五’  IN BOOLEAN MODE)

1 张三

2 张四

3 张五

5 李四

6 李五

###

select * from table_xxx_user where match(name) against(‘+张 四’  IN BOOLEAN MODE)

结果:

张四排第一个

2 张四

1 张三

3 张五

2. default natural language full-text searches

猜你喜欢

转载自20142014.iteye.com/blog/2338419
今日推荐