我在嘗試根據查詢中在該行中找到的單詞數來對匹配進行評分。我盯着這樣做:MySQL列格柵計數匹配查詢的單詞數量?
SELECT Text, MATCH(`Text`) AGAINST ('$s') AS Grade
但很快我意識到了這一點,因爲Grade
沒有工作,是基於很多東西一樣,例如訂單的話,每個字的長度等。
我只想知道連續出現的單詞的百分比。
EG:
$s = 'i want pizza'
`Text` = 'pizza I want' // In this case Grade should be 100 as all words are found
其他例子:
Text | Grade
pizza I want too | 100 // All words were found, It doesn't matter if there are extra words
pizza I want | 100
i want | 66 // Only 66% of the words are present
want want want | 33 // Only 33% of the words are present
怎麼樣'比薩餅我想 - 我too'?它也是100%嗎?什麼是評分標準? – alfasin 2012-07-17 06:45:00
也應該是100%。我不在乎是否有額外的單詞。 – lisovaccaro 2012-07-17 06:52:25
可能['soundex'](http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_soundex)可以幫助你 – diEcho 2012-07-17 06:56:26