Bug#18071 Result from MATCH() uses too many decimals

 - Use FORMAT as a workaround to only output the first 6 decimals of the value returned
from MATCH
 - This has been done before
parent dcceaae8
...@@ -447,12 +447,12 @@ t1 CREATE TABLE `t1` ( ...@@ -447,12 +447,12 @@ t1 CREATE TABLE `t1` (
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a TEXT, FULLTEXT KEY(a)); CREATE TABLE t1 (a TEXT, FULLTEXT KEY(a));
INSERT INTO t1 VALUES('test'),('test1'),('test'); INSERT INTO t1 VALUES('test'),('test1'),('test');
PREPARE stmt from "SELECT a, MATCH(a) AGAINST('test1 test') FROM t1 WHERE MATCH(a) AGAINST('test1 test')"; PREPARE stmt from "SELECT a, FORMAT(MATCH(a) AGAINST('test1 test'),6) FROM t1 WHERE MATCH(a) AGAINST('test1 test')";
EXECUTE stmt; EXECUTE stmt;
a MATCH(a) AGAINST('test1 test') a FORMAT(MATCH(a) AGAINST('test1 test'),6)
test1 0.68526661396027 test1 0.685267
EXECUTE stmt; EXECUTE stmt;
a MATCH(a) AGAINST('test1 test') a FORMAT(MATCH(a) AGAINST('test1 test'),6)
test1 0.68526661396027 test1 0.685267
DEALLOCATE PREPARE stmt; DEALLOCATE PREPARE stmt;
DROP TABLE t1; DROP TABLE t1;
...@@ -371,7 +371,7 @@ DROP TABLE t1; ...@@ -371,7 +371,7 @@ DROP TABLE t1;
# #
CREATE TABLE t1 (a TEXT, FULLTEXT KEY(a)); CREATE TABLE t1 (a TEXT, FULLTEXT KEY(a));
INSERT INTO t1 VALUES('test'),('test1'),('test'); INSERT INTO t1 VALUES('test'),('test1'),('test');
PREPARE stmt from "SELECT a, MATCH(a) AGAINST('test1 test') FROM t1 WHERE MATCH(a) AGAINST('test1 test')"; PREPARE stmt from "SELECT a, FORMAT(MATCH(a) AGAINST('test1 test'),6) FROM t1 WHERE MATCH(a) AGAINST('test1 test')";
EXECUTE stmt; EXECUTE stmt;
EXECUTE stmt; EXECUTE stmt;
DEALLOCATE PREPARE stmt; DEALLOCATE PREPARE stmt;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment