I've been testing a new similarity that overrides encodeNorm and decodeNorm
using Lucene 1.4.2.
 
While testing I've been running queries with explanations. I notice that in
the TermQuery.TermWeight class in the explain method is the following:
      Explanation fieldNormExpl = new Explanation();
      byte[] fieldNorms = reader.norms(field);
      float fieldNorm =
        fieldNorms!=null ? Similarity.decodeNorm(fieldNorms[doc]) : 0.0f;
      fieldNormExpl.setValue(fieldNorm);
      fieldNormExpl.setDescription("fieldNorm(field="+field+",
doc="+doc+")");
      fieldExpl.addDetail(fieldNormExpl);

 
Shouldn't the call to Similarity.decodeNorm be replaced with a call to
Similarity.getDefault().decodeNorm
 
Note: Similar constructions appear in PhrasePrefixQuery, PhraseQuery,
PhraseScorer,SpanScorer, SpanWeight and TermScorer
 
I also note that Similarity.encodeNorm appears in IndexReader and
DocumentWriter classes
 
I'm concerned that my overrides are getting ignored due to this.
 
Do I understand this correctly?
 
Thanks,
Dan

Reply via email to