lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Murzaku" <>
Subject RE: Are score values always between 0 and 1?
Date Tue, 15 Oct 2002 12:31:54 GMT
As results are sorted by score, you just need to look at the first to
set the score normalizer. The following code is from

    float scoreNorm = 1.0f;
    if (length > 0 && scoreDocs[0].score > 1.0f)
      scoreNorm = 1.0f / scoreDocs[0].score;

    int end = scoreDocs.length < length ? scoreDocs.length : length;
    for (int i = hitDocs.size(); i < end; i++)
      hitDocs.addElement(new HitDoc(scoreDocs[i].score*scoreNorm,

scoreNorm guarantees that all scores will be between 0 and 1.

-----Original Message-----
From: Dmitry Serebrennikov [] 
Sent: Tuesday, October 15, 2002 4:16 AM
To: Lucene Users List
Subject: Re: Are score values always between 0 and 1?

Ype Kingma wrote:

>On Tuesday 15 October 2002 04:16, Dmitry Serebrennikov wrote:
>>I know that the FAQ says that they are, but in at least one instance 
>>in my index it appears to be equal to 1.94something. Are the scores 
>>guaranteed to be between 0 and 1, and if not, what would it take to 
>>make them such?
>Division by the highest score perhaps?
>I did this for a short while, but then I removed it again because 
>is lost by the division. However, it is mainly a matter of presentation
>users, so you could let them be you guide in this.
Well, the problem is that I don't known what the highest score might be 
until I run into one that is higher than the one I thought was the 
highest until then... I'm trying to use this for making result from 
searcher always come before another in a MultiSearcher, but I need to 
know the upper bound on the scores to get this to work.

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message