行で見つかったクエリの単語数に基づいて一致を評価しようとしています。私はこれをじっと見つめました:
SELECT Text, MATCH(`Text`) AGAINST ('$s') AS Grade
しかし、すぐにこれが機能しないことに気付きました。これはGrade
、たとえば単語の順序、各単語の長さなどの多くのものに基づいているためです。
行に存在する単語の割合を知りたいだけです。
例えば:
$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