lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Toy <>
Subject problems writing a custom Similarity class
Date Sun, 25 Sep 2011 17:35:12 GMT
Hi all,
  I'm just starting to get into solr development and I want to try writing a
custom Scoring Class.  I copied the DefaultSimilarity class and renamed it
to TestSimilarity and then I just overwrote the function idf to return 1 so
that scores only look at the tf:
  public float idf(int docFreq, int numDocs) {
    return 1.0f;

I then make  sure my TestSimilarity is always used by editing
conf/schema.xml to have this line:
<similarity class="" />

Scoring seems to still be using an idf score that is not 1 and returning
results sorted by rareness of a phrase instead of frequency of the word.
I am following this tutorial:
Is there something else I need to do to sort by only term frequency?
I'd appreciate any help oor suggestions on this.


View raw message