Scoring calculation for Solr is something really complex. Here, you have to begin with the primal equation:
score(q,d) = coord(q,d) · queryNorm(q) · ∑ ( tf(t in d) ·
idf(t)2 · t.getBoost() · norm(t,d) )
You have tf
parameter which represents term frequency and its value is the squareroot of the frequency of the term.
You also have norm
(aka fieldNorm
) which is used in fieldWeight
calculation. Let's take your example:
Link Link Link Link Link
Your score will be calculate like (you can see this by adding debugQuery
parameter):
5.9249415 = fieldWeight, product of:
2.236068 = tf(freq=5.0), with freq of:
5.0 = termFreq=5.0
idf (wich will be the same for all your scores)
0.4375 = fieldNorm(doc=177)
link
6.037953= fieldWeight, product of:
1.0 = tf(freq=1.0), with freq of:
1.0 = termFreq=1.0
idf (wich will be the same for all your scores)
1.0 = fieldNorm
Here, link
has a better score than the other because fieldWeight
is the product of tf
, idf
and fieldNorm
. This last one is higher for link
document because he only contains one term.
As above documentation said:
lengthNorm - computed when the document is added to the index in
accordance with the number of tokens of this field in the document, so
that shorter fields contribute more to the score.
The more terms you have in a field, lower fieldNorm
will be.
Be careful with the value of this field.
So, to conclude, here you have a perfect mix to understand that the score is not calculated only with the frequency but also with the number of term that you have in your field.