0
我有類似如下的MySQL查詢:如何增加高級MySQL查詢中的相關性值?
SELECT *, MATCH (`Description`) AGAINST ('+ipod +touch ' IN BOOLEAN MODE) * 8 + MATCH(`Description`) AGAINST ('ipod touch' IN BOOLEAN MODE) AS Relevance
FROM products WHERE (MATCH (`Description`) AGAINST ('+ipod +touch' IN BOOLEAN MODE) OR MATCH(`LongDescription`) AGAINST ('+ipod +touch' IN BOOLEAN MODE))
HAVING Relevance > 1
ORDER BY Relevance DESC
現在,我所做的查詢也通過搜索UPC更先進:
SELECT *, MATCH (`Description`) AGAINST ('+ipod +touch ' IN BOOLEAN MODE) * 8 + MATCH(`Description`) AGAINST ('ipod touch' IN BOOLEAN MODE) + `UPC` = '123456789012' * 16 AS Relevance
FROM products WHERE (MATCH (`Description`) AGAINST ('+ipod +touch' IN BOOLEAN MODE) OR MATCH(`LongDescription`) AGAINST ('+ipod +touch' IN BOOLEAN MODE)) AND `UPC` = '123456789012'
HAVING Relevance > 1
ORDER BY Relevance DESC
那將返回結果,但是我在UPC上獲得了成功的比賽並不會增加價值Relevance
。我只能進行像MATCH()AGAINST()這樣的全文搜索的計算嗎?
澄清:好的,所以我真正的問題是,爲什麼以下沒有相關性> = 16?
SELECT `UPC`, `UPC` = '123456789012' * 16 AS Relevance FROM products WHERE `UPC` = '123456789012' HAVING Relevance > 1 ORDER BY Relevance DESC