>
>
>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.
>
Thanks for the suggestion and a good point. I didn't think of this. 
However, I still don't think I can use this trick because the code I am 
writing will run in a HitCollector that receives hits from multiple 
indexes (such as the one in MultiSearcher). There, hits arrive in order 
in which they are found, which is the insertion order. So I don't know 
when a hit with the highest score will come about.

Dmitry.



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to