我想在我的电子商店中显示相关产品列表。
问题在于,有时匹配是广泛的,是否有办法获得具有某种等级的列,以了解该行的匹配程度?
SELECT * FROM `Items` WHERE MATCH(`Title`,`Text`) AGAINST ('$allText')
答案 0 :(得分:1)
我认为这应该有用
SELECT *, MATCH(`Title`,`Text`) AGAINST ('$allText') as grade
FROM `Items` WHERE MATCH(`Title`,`Text`) AGAINST ('$allText')
ORDER BY grade DESC
答案 1 :(得分:0)
SELECT *, MATCH(`Title`,`Text`) AGAINST ('$allText') as score
FROM `Items` WHERE MATCH(`Title`,`Text`) AGAINST ('$allText') HAVING score>0.2
就像那样,你可以限制最好的结果。