summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb_fts
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2019-07-01 13:44:59 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2019-07-01 13:46:56 +0530
commited6da51f3e69430e0bdd6c2e839fd4d0dada0ba1 (patch)
treefbf90d119c08a0dbcbe63892732d59a305c40434 /mysql-test/suite/innodb_fts
parent723a4b1d78274b10222b03088ff75884b78c2ced (diff)
downloadmariadb-git-ed6da51f3e69430e0bdd6c2e839fd4d0dada0ba1.tar.gz
MDEV-19869 Port innodb_fts.fulltext2 from mysql to mariadb.
- Ported mysql Bug#20597981 test case to mariadb-10.2 - InnoDB never used fts_doc_id_in_read_set. Basically it tells innodb to read the fts_doc_id from the index record itself.
Diffstat (limited to 'mysql-test/suite/innodb_fts')
-rw-r--r--mysql-test/suite/innodb_fts/r/fulltext2.result30
-rw-r--r--mysql-test/suite/innodb_fts/t/fulltext2.test31
2 files changed, 56 insertions, 5 deletions
diff --git a/mysql-test/suite/innodb_fts/r/fulltext2.result b/mysql-test/suite/innodb_fts/r/fulltext2.result
index 2aa7d2a6754..0ce3dfa43a9 100644
--- a/mysql-test/suite/innodb_fts/r/fulltext2.result
+++ b/mysql-test/suite/innodb_fts/r/fulltext2.result
@@ -242,3 +242,33 @@ a
„MySQL“
DROP TABLE t1;
SET NAMES latin1;
+CREATE TABLE t1 (
+FTS_DOC_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+id int(10) not null ,
+first_name varchar(50) NOT NULL,
+last_name varchar(50) NOT NULL,
+PRIMARY KEY (FTS_DOC_ID),
+UNIQUE KEY idx_1 (first_name, last_name),
+FULLTEXT KEY `idx_2` (first_name)
+) ENGINE=InnoDB;
+INSERT INTO t1 (id, first_name, last_name) VALUES
+(10, 'Bart', 'Simpson'),
+(11, 'Homer', 'Simpson'),
+(12, 'Marge', 'Simpson'),
+(13, 'Lisa', 'Simpson'),
+(14, 'Maggie', 'Simpson'),
+(15, 'Ned', 'Flanders'),
+(16, 'Nelson', 'Muntz');
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+SELECT fts_doc_id, first_name, last_name, MATCH(first_name) AGAINST('Homer' IN BOOLEAN MODE) AS score FROM t1;
+fts_doc_id first_name last_name score
+1 Bart Simpson 0
+2 Homer Simpson 0.7141907215118408
+4 Lisa Simpson 0
+5 Maggie Simpson 0
+3 Marge Simpson 0
+6 Ned Flanders 0
+7 Nelson Muntz 0
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_fts/t/fulltext2.test b/mysql-test/suite/innodb_fts/t/fulltext2.test
index 33b6a7ac88e..6529630b01e 100644
--- a/mysql-test/suite/innodb_fts/t/fulltext2.test
+++ b/mysql-test/suite/innodb_fts/t/fulltext2.test
@@ -11,11 +11,6 @@
DROP TABLE IF EXISTS t1;
--enable_warnings
-if (`select plugin_auth_version <= "5.6.10" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not fixed in InnoDB 5.6.10 or earlier
-}
-
CREATE TABLE t1 (
i int(10) unsigned not null auto_increment primary key,
a varchar(255) not null,
@@ -239,3 +234,29 @@ INSERT INTO t1 VALUES('„MySQL“');
SELECT a FROM t1 WHERE MATCH a AGAINST('“MySQL„' IN BOOLEAN MODE);
DROP TABLE t1;
SET NAMES latin1;
+
+#
+# Bug #20597981 - WRONG RELEVANCE RANKING FOR FULL TEXT SEARCHES
+# WHEN FTS_DOC_ID IS PRIMARY KEY
+CREATE TABLE t1 (
+ FTS_DOC_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+ id int(10) not null ,
+ first_name varchar(50) NOT NULL,
+ last_name varchar(50) NOT NULL,
+ PRIMARY KEY (FTS_DOC_ID),
+ UNIQUE KEY idx_1 (first_name, last_name),
+ FULLTEXT KEY `idx_2` (first_name)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 (id, first_name, last_name) VALUES
+(10, 'Bart', 'Simpson'),
+(11, 'Homer', 'Simpson'),
+(12, 'Marge', 'Simpson'),
+(13, 'Lisa', 'Simpson'),
+(14, 'Maggie', 'Simpson'),
+(15, 'Ned', 'Flanders'),
+(16, 'Nelson', 'Muntz');
+
+analyze table t1;
+SELECT fts_doc_id, first_name, last_name, MATCH(first_name) AGAINST('Homer' IN BOOLEAN MODE) AS score FROM t1;
+DROP TABLE t1;