mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
528e85a4c0
The problem was that MySQL hadn't true ctype implementation. As a result many multibyte punctuation/whitespace characters were treated as word characters. This fix uses recently added CTYPE table for unicode character sets (WL1386) to detect unicode punctuation/whitespace characters correctly. Note: this is incompatible change since it changes parser behavior. One will have to use REPAIR TABLE statement to rebuild fulltext indexes. mysql-test/r/fulltext2.result: Testcase for BUG#19580. mysql-test/t/fulltext2.test: Testcase for BUG#19580. storage/myisam/ft_parser.c: Use WL1386 "CTYPE table for unicode character sets" functionality. storage/myisam/ft_update.c: Use WL1386 "CTYPE table for unicode character sets" functionality. Reverse fix for BUG#16489 "utf8 + fulltext leads to corrupt index file.". It is not needed anymore, since we have true ctype implementation. storage/myisam/ftdefs.h: Use WL1386 "CTYPE table for unicode character sets" functionality. Rework true_word_char macro so it accepts ctype instead of charset as first param. It doesn't use my_isalnum anymore, but instead directly checks ctype. Obsolete word_char macro removed.
251 lines
7.5 KiB
Text
251 lines
7.5 KiB
Text
DROP TABLE IF EXISTS t1;
|
||
CREATE TABLE t1 (
|
||
i int(10) unsigned not null auto_increment primary key,
|
||
a varchar(255) not null,
|
||
FULLTEXT KEY (a)
|
||
) ENGINE=MyISAM;
|
||
repair table t1 quick;
|
||
Table Op Msg_type Msg_text
|
||
test.t1 repair status OK
|
||
check table t1;
|
||
Table Op Msg_type Msg_text
|
||
test.t1 check status OK
|
||
optimize table t1;
|
||
Table Op Msg_type Msg_text
|
||
test.t1 optimize status OK
|
||
check table t1;
|
||
Table Op Msg_type Msg_text
|
||
test.t1 check status OK
|
||
select count(*) from t1 where match a against ('aaaxxx');
|
||
count(*)
|
||
260
|
||
select count(*) from t1 where match a against ('aaayyy');
|
||
count(*)
|
||
250
|
||
select count(*) from t1 where match a against ('aaazzz');
|
||
count(*)
|
||
255
|
||
select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
|
||
count(*)
|
||
260
|
||
select count(*) from t1 where match a against ('aaayyy' in boolean mode);
|
||
count(*)
|
||
250
|
||
select count(*) from t1 where match a against ('aaazzz' in boolean mode);
|
||
count(*)
|
||
255
|
||
select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz');
|
||
count(*)
|
||
765
|
||
select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz' in boolean mode);
|
||
count(*)
|
||
765
|
||
select count(*) from t1 where match a against ('aaax*' in boolean mode);
|
||
count(*)
|
||
260
|
||
select count(*) from t1 where match a against ('aaay*' in boolean mode);
|
||
count(*)
|
||
250
|
||
select count(*) from t1 where match a against ('aaa*' in boolean mode);
|
||
count(*)
|
||
765
|
||
insert t1 (a) values ('aaaxxx'),('aaayyy');
|
||
insert t1 (a) values ('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz');
|
||
select count(*) from t1 where match a against ('aaaxxx');
|
||
count(*)
|
||
261
|
||
select count(*) from t1 where match a against ('aaayyy');
|
||
count(*)
|
||
251
|
||
select count(*) from t1 where match a against ('aaazzz');
|
||
count(*)
|
||
260
|
||
insert t1 (a) values ('aaaxxx 000000');
|
||
select count(*) from t1 where match a against ('000000');
|
||
count(*)
|
||
1
|
||
delete from t1 where match a against ('000000');
|
||
select count(*) from t1 where match a against ('000000');
|
||
count(*)
|
||
0
|
||
select count(*) from t1 where match a against ('aaaxxx');
|
||
count(*)
|
||
261
|
||
delete from t1 where match a against ('aaazzz');
|
||
select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
|
||
count(*)
|
||
261
|
||
select count(*) from t1 where match a against ('aaayyy' in boolean mode);
|
||
count(*)
|
||
251
|
||
select count(*) from t1 where match a against ('aaazzz' in boolean mode);
|
||
count(*)
|
||
0
|
||
select count(*) from t1 where a = 'aaaxxx';
|
||
count(*)
|
||
261
|
||
select count(*) from t1 where a = 'aaayyy';
|
||
count(*)
|
||
251
|
||
select count(*) from t1 where a = 'aaazzz';
|
||
count(*)
|
||
0
|
||
insert t1 (a) values ('aaaxxx 000000');
|
||
select count(*) from t1 where match a against ('000000');
|
||
count(*)
|
||
1
|
||
update t1 set a='aaazzz' where match a against ('000000');
|
||
select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
|
||
count(*)
|
||
261
|
||
select count(*) from t1 where match a against ('aaazzz' in boolean mode);
|
||
count(*)
|
||
1
|
||
update t1 set a='aaazzz' where a = 'aaaxxx';
|
||
update t1 set a='aaaxxx' where a = 'aaayyy';
|
||
select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
|
||
count(*)
|
||
251
|
||
select count(*) from t1 where match a against ('aaayyy' in boolean mode);
|
||
count(*)
|
||
0
|
||
select count(*) from t1 where match a against ('aaazzz' in boolean mode);
|
||
count(*)
|
||
262
|
||
drop table t1;
|
||
CREATE TABLE t1 (
|
||
i int(10) unsigned not null auto_increment primary key,
|
||
a varchar(255) not null,
|
||
FULLTEXT KEY (a)
|
||
) ENGINE=MyISAM;
|
||
select count(*) from t1 where match a against ('aaaxxx');
|
||
count(*)
|
||
260
|
||
select count(*) from t1 where match a against ('aaayyy');
|
||
count(*)
|
||
250
|
||
select count(*) from t1 where match a against ('aaazzz');
|
||
count(*)
|
||
255
|
||
select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
|
||
count(*)
|
||
260
|
||
select count(*) from t1 where match a against ('aaayyy' in boolean mode);
|
||
count(*)
|
||
250
|
||
select count(*) from t1 where match a against ('aaazzz' in boolean mode);
|
||
count(*)
|
||
255
|
||
select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz');
|
||
count(*)
|
||
765
|
||
select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz' in boolean mode);
|
||
count(*)
|
||
765
|
||
select count(*) from t1 where match a against ('aaax*' in boolean mode);
|
||
count(*)
|
||
260
|
||
select count(*) from t1 where match a against ('aaay*' in boolean mode);
|
||
count(*)
|
||
250
|
||
select count(*) from t1 where match a against ('aaa*' in boolean mode);
|
||
count(*)
|
||
765
|
||
insert t1 (a) values ('aaaxxx'),('aaayyy');
|
||
insert t1 (a) values ('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz');
|
||
select count(*) from t1 where match a against ('aaaxxx');
|
||
count(*)
|
||
261
|
||
select count(*) from t1 where match a against ('aaayyy');
|
||
count(*)
|
||
251
|
||
select count(*) from t1 where match a against ('aaazzz');
|
||
count(*)
|
||
260
|
||
insert t1 (a) values ('aaaxxx 000000');
|
||
select count(*) from t1 where match a against ('000000');
|
||
count(*)
|
||
1
|
||
delete from t1 where match a against ('000000');
|
||
select count(*) from t1 where match a against ('000000');
|
||
count(*)
|
||
0
|
||
select count(*) from t1 where match a against ('aaaxxx');
|
||
count(*)
|
||
261
|
||
delete from t1 where match a against ('aaazzz');
|
||
select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
|
||
count(*)
|
||
261
|
||
select count(*) from t1 where match a against ('aaayyy' in boolean mode);
|
||
count(*)
|
||
251
|
||
select count(*) from t1 where match a against ('aaazzz' in boolean mode);
|
||
count(*)
|
||
0
|
||
select count(*) from t1 where a = 'aaaxxx';
|
||
count(*)
|
||
261
|
||
select count(*) from t1 where a = 'aaayyy';
|
||
count(*)
|
||
251
|
||
select count(*) from t1 where a = 'aaazzz';
|
||
count(*)
|
||
0
|
||
insert t1 (a) values ('aaaxxx 000000');
|
||
select count(*) from t1 where match a against ('000000');
|
||
count(*)
|
||
1
|
||
update t1 set a='aaazzz' where match a against ('000000');
|
||
select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
|
||
count(*)
|
||
261
|
||
select count(*) from t1 where match a against ('aaazzz' in boolean mode);
|
||
count(*)
|
||
1
|
||
update t1 set a='aaazzz' where a = 'aaaxxx';
|
||
update t1 set a='aaaxxx' where a = 'aaayyy';
|
||
select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
|
||
count(*)
|
||
251
|
||
select count(*) from t1 where match a against ('aaayyy' in boolean mode);
|
||
count(*)
|
||
0
|
||
select count(*) from t1 where match a against ('aaazzz' in boolean mode);
|
||
count(*)
|
||
262
|
||
drop table t1;
|
||
set names utf8;
|
||
create table t1(a text,fulltext(a)) collate=utf8_swedish_ci;
|
||
insert into t1 values('test test '),('test'),('test'),('test'),
|
||
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
|
||
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
|
||
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
|
||
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
|
||
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
|
||
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
|
||
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
|
||
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
|
||
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
|
||
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
|
||
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
|
||
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
|
||
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
|
||
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
|
||
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test');
|
||
delete from t1 limit 1;
|
||
truncate table t1;
|
||
insert into t1 values('ab c d');
|
||
update t1 set a='ab c d';
|
||
select * from t1 where match a against('ab c' in boolean mode);
|
||
a
|
||
drop table t1;
|
||
set names latin1;
|
||
SET NAMES utf8;
|
||
CREATE TABLE t1(a VARCHAR(255), FULLTEXT(a)) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||
INSERT INTO t1 VALUES('„MySQL“');
|
||
SELECT a FROM t1 WHERE MATCH a AGAINST('“MySQL„' IN BOOLEAN MODE);
|
||
a
|
||
„MySQL“
|
||
DROP TABLE t1;
|
||
SET NAMES latin1;
|