For mysql or mariaDB, Boolean search really does not return in relevance order?
I already checked both documentations(for mysql and mariaDB latest versions):
For boolean mode, searches are not returned in order of relevance! https://dev.mysql.com/doc/refman/5.7/en/fulltext-boolean.html https://mariadb.com/kb/en/mariadb/fulltext-index-overview/
But when i test it, it IS sorting by relevance! I ran some tests and it is sorting by the return of MATCH(which i believe is the relevance,right!?)! Is the documentation out of date? Or am i missing something?
Tests on 10.1.25-MariaDB
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(id INT PRIMARY KEY,c1 varchar(30),FULLTEXT(c1));
INSERT INTO t1(id,c1) VALUES
(1,'aaa'),
(2,'aaa bbb ccc'),
(3,'aaa bbb');
SET @a='aaa bbb ccc';
SELECT id
FROM t1 WHERE
MATCH(c1) AGAINST(@a IN BOOLEAN MODE); # 2,3,1
SELECT id, MATCH(c1) AGAINST(@a IN BOOLEAN MODE) as rev
FROM t1 WHERE
MATCH(c1) AGAINST(@a IN BOOLEAN MODE) ORDER BY rev DESC; # 2,3,1
链接地址: http://www.djcxy.com/p/75298.html