AlexElba wrote:
>
> Hello,
> I have project which I am trying to switch from lucene 2.3.2 to 2.4 I am
> getting some strange scores
>
> Before my code was:
>
> Hits hits= searcher.search(query);
> Float score = hits.score(1)
>
> and scores from hist was from 0-1; 1 was 100% match
>
> I chan
How are you using the score? The fact that you want them back to the
old way implies to me that you are using them for something other than
for sorting the results.
On Jan 29, 2009, at 8:21 PM, AlexElba wrote:
Hello,
I have project which I am trying to switch from lucene 2.3.2 to 2.4
I
: To get the normalized scores use:
...
: float score = hits[1].score / td.getMaxScore();
Strictly speaking, this code will not return the exact same scores as the
deprecated Hits API. the Hits class only normalizes the scores if the max
score is greater then 1.0f
(yet another one of
To get the normalized scores use:
TopDocCollector collector = new TopDocCollector(99);
searcher.search(query, collector);
TopDocs td = collector.topDocs();
ScoreDocs[] hits = td.scoreDocs;
int docId = hits[1].doc;
Document document = searcher.doc(docId);
float score = hits[1].score / td.getMax
HitCollector scores are not normalized to the 0-1 range, they
are "raw". You have to get the maximum score returned and
normalize the raw scores. See TopDocs.getMaxScore
as I remember.
Best
Erick
On Thu, Jan 29, 2009 at 8:21 PM, AlexElba wrote:
>
> Hello,
> I have project which I am trying to s