DROP TABLE IF EXISTS texts;
SET NAMES UTF8MB4;
CREATE TABLE texts (
id INT PRIMARY KEY,
matched TEXT,
not_matched TEXT,
FULLTEXT KEY (matched),
FULLTEXT KEY (not_matched)
) DEFAULT CHARSET=UTF8MB4 COMMENT='engine "InnoDB"';
INSERT INTO texts VALUES (1, 'Hello1', 'World1');
INSERT INTO texts VALUES (2, 'Hello2', 'World2');
INSERT INTO texts VALUES (3, 'Hello3', 'World3');
SELECT id,
matched,
not_matched,
MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE),
MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE)
FROM texts
ORDER BY MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE),
MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE),
id;
id	matched	not_matched	MATCH(matched) AGAINST('+Hello' IN BOOLEAN MODE)	MATCH(not_matched) AGAINST('+Hello' IN BOOLEAN MODE)
1	Hello1	World1	1	0
2	Hello2	World2	1	0
3	Hello3	World3	1	0
DROP TABLE texts;
