It takes the highest scoring document, if greater than 1.0, and
divides every hit's score by this number, leaving them all <= 1.0.
Actually, I just looked at the code, and it actually does this by
taking 1/maxScore and then multiplying this by each score (equivalent
results in the end, maybe more efficient(?)). See the method
getMoreDocs() in Hits.java (org.apache.lucene.search.Hits):
[...]
float scoreNorm = 1.0f;
if (length > 0 && topDocs.getMaxScore() > 1.0f) {
scoreNorm = 1.0f / topDocs.getMaxScore();
}
int end = scoreDocs.length < length ? scoreDocs.length : length;
for (int i = hitDocs.size(); i < end; i++) {
hitDocs.addElement(new HitDoc(scoreDocs[i].score * scoreNorm,
scoreDocs[i].doc));
}
On 1/27/06, xing jiang <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I want to know how the lucene normalizes the score. I see hits class has
> this function to get each document's score. But i dont know how lucene
> calculates the normalized score and in the "Lucene in action", it only said
> normalized score of the nth top scoring docuemnts.
> --
> Regards
>
> Jiang Xing
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]