lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Carlson <carl...@bookandhammer.com>
Subject Re: lucene-user Digest 15 Oct 2002 12:32:47 -0000 Issue 170
Date Wed, 16 Oct 2002 06:02:22 GMT
If I understand you correctly, you want to calculate a score which will 
be automatically sorted appropriately.

How are you suggesting sorting by a field value without getting the 
data from the field?

I like the idea.

Also, the SearchBean startup is relatively fast at startup, only about 
3sec for about 100K records. This could also be cached once it's read 
from the index and load time would be much faster.

--Peter


On Tuesday, October 15, 2002, at 10:14 AM, Dmitry Serebrennikov wrote:

>>
>>
>> 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:lucene-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: 
> <mailto:lucene-user-help@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>


Mime
View raw message