| 1 |
create table t ( |
| 2 |
FTS_DOC_ID bigint unsigned not null, |
| 3 |
contents text collate utf8mb4_bin, |
| 4 |
primary key (FTS_DOC_ID), |
| 5 |
fulltext key fx_contents (contents) with parser ngram |
| 6 |
) engine=innodb default charset=utf8mb4 collate=utf8mb4_bin; |
| 7 |
insert into t values (1, 'xyz mnt'), (2, 'xyz mnt'), (3, 'xyz'); |
| 8 |
select * from t where match(contents) against ('xyz mnt' in boolean mode) limit 1; |
| 9 |
FTS_DOC_ID contents |
| 10 |
1 xyz mnt |
| 11 |
select * from t where match(contents) against ('xyz mnt' in boolean mode) limit 2; |
| 12 |
FTS_DOC_ID contents |
| 13 |
1 xyz mnt |
| 14 |
2 xyz mnt |
| 15 |
select * from t where match(contents) against ('xyz mnt' in boolean mode) limit 3; |
| 16 |
FTS_DOC_ID contents |
| 17 |
1 xyz mnt |
| 18 |
2 xyz mnt |
| 19 |
3 xyz |
| 20 |
select * from t where match(contents) against ('xyz mnt' in boolean mode) limit 4; |
| 21 |
FTS_DOC_ID contents |
| 22 |
1 xyz mnt |
| 23 |
2 xyz mnt |
| 24 |
3 xyz |
| 25 |
select * from t where match(contents) against ('xyz mnt' in boolean mode) limit 5; |
| 26 |
FTS_DOC_ID contents |
| 27 |
1 xyz mnt |
| 28 |
2 xyz mnt |
| 29 |
3 xyz |
| 30 |
select * from t WHERE match(contents) against ('xyz mnt' in boolean mode) limit 6; |
| 31 |
FTS_DOC_ID contents |
| 32 |
1 xyz mnt |
| 33 |
2 xyz mnt |
| 34 |
3 xyz |
| 35 |
DROP TABLE t; |