lucene-java-user mailing list archives

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


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

2.       How and where is fieldNorm calculated?


Thank you very much!




Oliver Xu(徐永)
Aigine InfoTech Co.(语擎科技)
W: <>
T: +86-189189 02886
E:  <>
Weibo: 语擎-集体智慧编程


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