Mysql 如何找到两个全文搜索结果之间的平均相关性
我的数据库中有一个表,例如,Mysql 如何找到两个全文搜索结果之间的平均相关性,mysql,math,search,mariadb,full-text-search,Mysql,Math,Search,Mariadb,Full Text Search,我的数据库中有一个表,例如,账单。它有外键user\u id和company\u id,分别引用users和companys表users和companys表中的列名为name全文在用户上创建的indexex。名称和公司。名称 我正在对name列进行全文搜索。因此,我有两个大于0的正实数 select bills.id, MATCH(users.name) AGAINST('John Doe'), MATCH(companies.name) AGAINST('John
账单
。它有外键user\u id
和company\u id
,分别引用users
和companys
表users
和companys
表中的列名为name
<代码>全文在用户上创建的indexex。名称
和公司。名称
我正在对name
列进行全文搜索。因此,我有两个大于0的正实数
select bills.id,
MATCH(users.name) AGAINST('John Doe'),
MATCH(companies.name) AGAINST('John Doe')
from bills
left join users on bills.user_id = users.id
left join companies on bills.company_id = companies.id;
在我的查询中,我天真地将匹配项求和为score
(MATCH(users.name) AGAINST('John Doe') +
MATCH(companies.name) AGAINST('John Doe')) as score
因此,生成的查询看起来:
select bills.id,
(MATCH(users.name) AGAINST('John Doe') +
MATCH(companies.name) AGAINST('John Doe')) as score
from bills
left join users on bills.user_id = users.id
left join companies on bills.company_id = companies.id;
在我按分数排序结果之后
但是,有没有更合适的方法来计算多个匹配之间的平均相关性