lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan Climan" <dcli...@keepmedia.com>
Subject Explanations and overridden similarity
Date Thu, 16 Dec 2004 20:28:04 GMT
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

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