lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil brunet" <philouc...@hotmail.com>
Subject Re: score and frequency
Date Fri, 04 Jun 2004 15:10:05 GMT
Hi to all.

Maybe the term frequency is not the only parameter you need to override to 
"customize" the score attributed by Lucene.

Maybe you should consider the normalisation factor, the idf and the coord 
factor ?

Philippe

>From: "Niraj Alok" <niraj@emacmillan.com>
>Reply-To: "Lucene Users List" <lucene-user@jakarta.apache.org>
>To: "Lucene Users List" <lucene-user@jakarta.apache.org>
>Subject: Re: score and frequency
>Date: Fri, 4 Jun 2004 15:13:32 +0530
>
>Hi Erik,
>
>Thanks for the suggestion.
>
>I tried this:
>public class RelevanceSimilarity extends DefaultSimilarity
>
>{
>
>public float tf(float freq) {
>
>System.out.println("discounting frequency");
>
>return (float)1;
>
>}
>
>}
>
>
>
>and in my query class, I used :
>
>Similarity.setDefault(similarity);
>
>Hits hits = is.search(query);
>
>for(i = 0; i < hits.length(); i ++)
>
>   result = result + hits.score(i);
>
>
>
>However, this is still not giving me the expected result. Do I need to do
>something else?
>
>
>Regards,
>Niraj
>
>----- Original Message -----
>From: "Erik Hatcher" <erik@ehatchersolutions.com>
>To: "Lucene Users List" <lucene-user@jakarta.apache.org>
>Sent: Friday, June 04, 2004 1:55 PM
>Subject: Re: score and frequency
>
>
> > On Jun 4, 2004, at 2:52 AM, Niraj Alok wrote:
> > > Hi,
> > >
> > > I am having some problems with the score of lucene.
> > > I am trying to get the results displayed according to hits.score and
> > > it is giving the results correctly.
> > > However I do not want the frequency factor to be used for the
> > > computation of the score.
> > >
> > > Is it possible to get the score which does not have the frequency
> > > factor in it ?
> >
> > Have a look at the javadocs for Similarity.  DefaultSimilarity is used
> > unless otherwise specified.  You could subclass that and override this:
> >
> >    public float tf(float freq) {
> >      return (float)Math.sqrt(freq);
> >    }
> >
> > and return 1.0.  This might give you the effect you want.
> >
> > Erik
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> >
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>

_________________________________________________________________
Bloquez les fenĂȘtres pop-up, c'est gratuit ! http://toolbar.msn.fr


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


Mime
View raw message