簡體   English   中英

有什么方法可以衡量結果與全文查詢的匹配程度嗎?

[英]Is there some way to measure how much a result matches fulltext query?

我想在我的eshop中顯示相關產品的列表。

問題是有時匹配范圍很廣,有沒有辦法讓某等級的小學生知道該行的匹配程度?

SELECT * FROM `Items` WHERE MATCH(`Title`,`Text`) AGAINST ('$allText')

我認為這應該工作

SELECT *, MATCH(`Title`,`Text`) AGAINST ('$allText') as grade 
FROM `Items` WHERE MATCH(`Title`,`Text`) AGAINST ('$allText') 
ORDER BY grade DESC
SELECT *, MATCH(`Title`,`Text`) AGAINST ('$allText') as score
FROM `Items` WHERE MATCH(`Title`,`Text`) AGAINST ('$allText') HAVING score>0.2

這樣,您可以限制最佳結果。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM