I overided DefaultSimilarity :
package org.apache.lenya.lucene.index;
import org.apache.lucene.search.DefaultSimilarity;
public class PersonalSimilarity extends DefaultSimilarity {
public float idf(int docFreq, int numDocs)
{
return 1;
}
}
And I use it like this :
PersonalSimilarity ds = new PersonalSimilarity();
searcher.setSimilarity(ds);
After that all the hit have the same score wich seems to be not normalized
anymore (the new unique score value is not equals to 100% but perhaps
something about 90%)
jreeman wrote:
>
> Hello,
>
> the original post is here :
>
> http://www.nabble.com/Question-about-hits-scores-tf3332761.html
> http://www.nabble.com/Question-about-hits-scores-tf3332761.html
>
> but I am re-explaining my problem.
>
> here is the query I am sending to lucene :
>
> +(document_type:type0one +document_type:type0twenty0one)
>
> document_type is q meta-data. 0 is used as a separator in "type0one " and
> "type0twenty0one".
>
> And the result, hits returned :
>
> 1 hit type0one, score 100%
> 1 hit type0twenty0one, score 80%
> 1 hit type0twenty0one, score 80%
>
> The rarer document have a score higher than other, that's why all the hits
> doesn't have the same score.
>
> However that's what I would appreciate so I used my own Similarity class
> like this :
>
> DefaultSimilarity similarity = new DefaultSimilarity();
> similarity.idf(0, 1); // idf is set to 1 whithis line of code
> searcher.setSimilarity(similarity);
> hits=searcher.search(l_query);
>
> But it doesn't affect the score. I always have
> 1 hit type0one, score 100%
> 2 hits type0twenty0one, score 80%
>
> Do you have suggestions to get all the hits with a score of 100% ?
>
--
View this message in context:
http://www.nabble.com/Searching-by-metadata-and-score-issue-tf3333361.html#a9269576
Sent from the Lucene - General mailing list archive at Nabble.com.