MySQL全文搜索分数解释 [英] MySQL Fulltext Search Score Explained
问题描述
我最近一直在尝试全文搜索,并对Score值的含义感到好奇。例如,我有以下查询:
SELECT表。 *,
MATCH(
col1,col2,col3
)
反对(
'+(Term1)+(Term1)'
)AS分数
FROM table
WHERE MATCH(
col1,col2,col3
)
反对(
'+(Term1)+(Term1)'
)
在Score的结果中,我发现一个查询的结果在0.4667041301727到11.166275978088之间。我知道这是MySQL关联的想法(权重越高)。
我没有得到的是MySQL如何得到这个分数。为什么数字不是以小数或其他方式返回?
如果我运行查询IN BOOLEAN MODE,得分总是返回1还是0?难道所有的结果都不是1吗?仅仅希望得到启发。感谢。
通常,相关性是基于每行与搜索词相匹配的次数。确切的值将取决于许多事情,但它确实只是在同一个查询中与其他相关值进行比较很重要。
如果你真的想要它背后的数学,你可以在内部手册中找到它。
I've been experimenting with fulltext search lately and am curious about the meaning of the Score value. For example I have the following query:
SELECT table. * ,
MATCH (
col1, col2, col3
)
AGAINST (
'+(Term1) +(Term1)'
) AS Score
FROM table
WHERE MATCH (
col1, col2, col3
)
AGAINST (
'+(Term1) +(Term1)'
)
In the results for Score I've seen results, for one query, between 0.4667041301727 to 11.166275978088. I get that it's MySQLs idea of relevance (the higher the more weight).
What I don't get is how MySQL comes up with that score. Why is the number not returned as a decimal or something besides ?
How come if I run a query "IN BOOLEAN MODE" does the score always return a 1 or a 0 ? Wouldn't all the results be a 1?
Just hoping for some enlightenment. Thanks.
Generally relevance is based on how many matches each row has to the words given to the search. The exact value will depend on many things, but it really only matters for comparing to other relevance values in the same query.
If you really want the math behind it, you can find it at the internals manual.
这篇关于MySQL全文搜索分数解释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!