2
# test of new fulltext search features
10
DROP TABLE IF EXISTS t1;
14
i int(10) unsigned not null auto_increment primary key,
15
a varchar(255) not null,
19
# two-level entry, second-level tree with depth 2
24
eval insert t1 (a) values ('aaaxxx');
28
# two-level entry, second-level tree has only one page
32
eval insert t1 (a) values ('aaazzz');
36
# one-level entry (entries)
40
eval insert t1 (a) values ('aaayyy');
45
# converting to two-level
46
repair table t1 quick;
48
optimize table t1; # BUG#5327 - mi_sort_index() of 2-level tree
51
select count(*) from t1 where match a against ('aaaxxx');
52
select count(*) from t1 where match a against ('aaayyy');
53
select count(*) from t1 where match a against ('aaazzz');
54
select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
55
select count(*) from t1 where match a against ('aaayyy' in boolean mode);
56
select count(*) from t1 where match a against ('aaazzz' in boolean mode);
57
select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz');
58
select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz' in boolean mode);
60
select count(*) from t1 where match a against ('aaax*' in boolean mode);
61
select count(*) from t1 where match a against ('aaay*' in boolean mode);
62
select count(*) from t1 where match a against ('aaa*' in boolean mode);
66
insert t1 (a) values ('aaaxxx'),('aaayyy');
67
# call to enlarge_root() below
68
insert t1 (a) values ('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz');
69
select count(*) from t1 where match a against ('aaaxxx');
70
select count(*) from t1 where match a against ('aaayyy');
71
select count(*) from t1 where match a against ('aaazzz');
74
insert t1 (a) values ('aaaxxx 000000');
75
select count(*) from t1 where match a against ('000000');
76
delete from t1 where match a against ('000000');
77
select count(*) from t1 where match a against ('000000');
78
select count(*) from t1 where match a against ('aaaxxx');
79
delete from t1 where match a against ('aaazzz');
80
select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
81
select count(*) from t1 where match a against ('aaayyy' in boolean mode);
82
select count(*) from t1 where match a against ('aaazzz' in boolean mode);
83
# double-check without index
84
select count(*) from t1 where a = 'aaaxxx';
85
select count(*) from t1 where a = 'aaayyy';
86
select count(*) from t1 where a = 'aaazzz';
89
insert t1 (a) values ('aaaxxx 000000');
90
select count(*) from t1 where match a against ('000000');
91
update t1 set a='aaazzz' where match a against ('000000');
92
select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
93
select count(*) from t1 where match a against ('aaazzz' in boolean mode);
94
update t1 set a='aaazzz' where a = 'aaaxxx';
95
update t1 set a='aaaxxx' where a = 'aaayyy';
96
select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
97
select count(*) from t1 where match a against ('aaayyy' in boolean mode);
98
select count(*) from t1 where match a against ('aaazzz' in boolean mode);
103
i int(10) unsigned not null auto_increment primary key,
104
a varchar(255) not null,
109
# now same as about but w/o repair table
110
# 2-level tree created by mi_write
113
# two-level entry, second-level tree with depth 2
118
eval insert t1 (a) values ('aaaxxx');
124
eval insert t1 (a) values ('aaazzz');
130
eval insert t1 (a) values ('aaayyy');
135
select count(*) from t1 where match a against ('aaaxxx');
136
select count(*) from t1 where match a against ('aaayyy');
137
select count(*) from t1 where match a against ('aaazzz');
138
select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
139
select count(*) from t1 where match a against ('aaayyy' in boolean mode);
140
select count(*) from t1 where match a against ('aaazzz' in boolean mode);
141
select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz');
142
select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz' in boolean mode);
144
select count(*) from t1 where match a against ('aaax*' in boolean mode);
145
select count(*) from t1 where match a against ('aaay*' in boolean mode);
146
select count(*) from t1 where match a against ('aaa*' in boolean mode);
150
insert t1 (a) values ('aaaxxx'),('aaayyy');
151
insert t1 (a) values ('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz');
152
select count(*) from t1 where match a against ('aaaxxx');
153
select count(*) from t1 where match a against ('aaayyy');
154
select count(*) from t1 where match a against ('aaazzz');
157
insert t1 (a) values ('aaaxxx 000000');
158
select count(*) from t1 where match a against ('000000');
159
delete from t1 where match a against ('000000');
160
select count(*) from t1 where match a against ('000000');
161
select count(*) from t1 where match a against ('aaaxxx');
162
delete from t1 where match a against ('aaazzz');
163
select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
164
select count(*) from t1 where match a against ('aaayyy' in boolean mode);
165
select count(*) from t1 where match a against ('aaazzz' in boolean mode);
166
# double-check without index
167
select count(*) from t1 where a = 'aaaxxx';
168
select count(*) from t1 where a = 'aaayyy';
169
select count(*) from t1 where a = 'aaazzz';
172
insert t1 (a) values ('aaaxxx 000000');
173
select count(*) from t1 where match a against ('000000');
174
update t1 set a='aaazzz' where match a against ('000000');
175
select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
176
select count(*) from t1 where match a against ('aaazzz' in boolean mode);
177
update t1 set a='aaazzz' where a = 'aaaxxx';
178
update t1 set a='aaaxxx' where a = 'aaayyy';
179
select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
180
select count(*) from t1 where match a against ('aaayyy' in boolean mode);
181
select count(*) from t1 where match a against ('aaazzz' in boolean mode);
187
# for uca collation isalnum and strnncollsp don't agree on whether
188
# 0xC2A0 is a space (strnncollsp is right, isalnum is wrong).
190
# they still don't, the bug was fixed by avoiding strnncollsp
194
create table t1(a text,fulltext(a)) collate=utf8_swedish_ci;
195
insert into t1 values('test test '),('test'),('test'),('test'),
196
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
197
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
198
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
199
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
200
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
201
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
202
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
203
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
204
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
205
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
206
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
207
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
208
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
209
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
210
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test');
211
delete from t1 limit 1;
214
# BUG#16489: utf8 + fulltext leads to corrupt index file.
217
insert into t1 values('ab c d');
218
update t1 set a='ab c d';
219
select * from t1 where match a against('ab c' in boolean mode);
226
# BUG#19580 - FULLTEXT search produces wrong results on UTF-8 columns
229
CREATE TABLE t1(a VARCHAR(255), FULLTEXT(a)) ENGINE=MyISAM DEFAULT CHARSET=utf8;
230
INSERT INTO t1 VALUES('„MySQL“');
231
SELECT a FROM t1 WHERE MATCH a AGAINST('“MySQL„' IN BOOLEAN MODE);