如何在mysql全文搜索中获得相关搜索?

oxalkeyp  于 2021-06-20  发布在  Mysql
关注(0)|答案(1)|浏览(337)

我想要准确的“果阿生产房屋”的相关性。它也会产生任何含有goa的结果。

SELECT * FROM `app_search` WHERE MATCH (`keywords`) AGAINST
("production house in goa" in boolean mode) 
order by MATCH (`keywords`) AGAINST ("production house in goa" in boolean mode)
desc, rank desc;

谢谢

a8jjtwal

a8jjtwal1#

删除旧表并在关键字和下面的查询上用全文索引重新创建可以解决这个问题。

SELECT *, MATCH (`keywords`) AGAINST
('software development in florida'
IN BOOLEAN MODE) AS score
FROM `ftextsearch` WHERE MATCH (keywords) AGAINST
('software development in florid'
IN BOOLEAN MODE) order by score desc,rank desc

查询还返回score中搜索的相关性。

相关问题