lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oliver Xu" <oliver.xuy...@gmail.com>
Subject A Problem in Customizing DefaultSimilarity
Date Wed, 12 Jun 2013 13:00:01 GMT
Dear,

 

I built my own scoring class by extending the DefaultSimilarity. Three major
methods from DefaultSimilarity were overrided, including:

1. public float lengthNorm(FieldInvertState state)

2. public float tf(float freq)

3.public float idf(long docFreq, long numDocs)

 

However, with embedded printing sentences (they are used to indicate which
and when a method is called by printing messages to console), I found only
tf() and idf() were called during a search process. The method lengthNorm(),
which is really what I wanted to work on, was never called.

 

I rolled back to Lucene350 and checked again. The DefaultSimilarity under
Lucene 350 uses a computeNorm() method instead of lengthNorm(). And again,
the overrided computeNorm() is never called either.

 

I used explanation() to check the components of each score for a document.
Besides the idf and tf scores, I did find a fieldNorm score, which has
something to do with the document length.

 

My questions are:

1.       Why are the overrided lengthNorm() (under Lucene410) or
computeNorm() (under Lucene350) methods not called during a searching
process?

2.       How and where is fieldNorm calculated?

 

Thank you very much!

 

Oliver

 

Oliver Xu(徐永)
Aigine InfoTech Co.(语擎科技)
W: <http://www.aigine.com> www.aigine.com
T: +86-189189 02886
E:  <mailto:oliver.xu@aigine.com> oliver.xu@aigine.com
MSN: oliver_xuyong@msn.com
Weibo: 语擎-集体智慧编程

 


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