As results are sorted by score, you just need to look at the first to
set the score normalizer. The following code is from Hits.java:
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,
scoreDocs[i].doc));
scoreNorm guarantees that all scores will be between 0 and 1.
-----Original Message-----
From: Dmitry Serebrennikov [mailto:[EMAIL PROTECTED]]
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:
>
>
>>Greetings,
>>
>>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
>information
>is lost by the division. However, it is mainly a matter of presentation
to
>users, so you could let them be you guide in this.
>
>Regards,
>Ype
>
>
>
>
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:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>