lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amin Mohammed-Coleman <ami...@gmail.com>
Subject Similarity and Lucene
Date Fri, 20 Mar 2009 16:20:31 GMT
Hi

If I choose to subclass  the default similarity, do I need to apply the same
subclassed Similarity to IndexReader, IndexWriter and IndexSearcher?

I am interested in doing the below:

Similarity sim = new DefaultSimilarity() {
  public float lengthNorm(String field, int numTerms) {
    if(field.equals("body")) return (float) (0.1 * Math.log(numTerms));
    else return super.lengthNorm(field, numTerms);
  }
}

[taken from http://www.lucenetutorial.com/advanced-topics/scoring.html]

Is this approach advisable?


Cheers
Amin

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message