To get the normalized scores use:

TopDocCollector collector = new TopDocCollector(999999);
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.getMaxScore();

Uwe
-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: u...@thetaphi.de

> -----Original Message-----
> From: AlexElba [mailto:ramal...@yahoo.com]
> Sent: Friday, January 30, 2009 2:22 AM
> To: java-user@lucene.apache.org
> Subject: Lunene 2.3-2.4 switch: Scoring change
> 
> 
> 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 change code to use hit collector
> 
>   TopDocCollector collector = new TopDocCollector(999999);
>      searcher.search(query, collector);
>      ScoreDocs[] hits= collector.topDocs().scoreDocs;
>      int docId = hits[1].doc;
>      Document document = searcher.doc(docId);
>     Float score = hits[1].score
> 
> The scores from this class are from 2-12.5 for the same query.
> 
> How to change my scores to old way?
> 
> 
> 
> 
> 
> --
> View this message in context: http://www.nabble.com/Lunene-2.3-2.4-
> switch%3A-Scoring-change-tp21739867p21739867.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to