match against

match against

 

Full-Text can only be used in MyISAM before 5.6, and can be used in InnoDB since 5.6

 

 

id name

1 card three

2 fours

3 sheets of five

4 Li San

5 Li Si

6 Li Wu

1. Boolead Full-text Searches

 

illustrate:

+ AND

- AND NOT

space or

 

###

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

 

result:

1 card three

 

###

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

1 card three

2 fours

3 sheets of five

5 Li Si

6 Li Wu

 

###

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

 

result:

Zhang fourth row first

 

2 fours

1 card three

3 sheets of five

 

 

2. default natural language full-text searches

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326603121&siteId=291194637