lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: Overriding Similarity
Date Sat, 19 Aug 2006 22:47:08 GMT
: And then I made this subclass the default similarity. It worked well
: for tf but not for lengthNorm. The reason appears to be that the
: TermScorer class does not call lengthNorm, but instead uses a cache

Acctually, the lengthNorm method is used by the IndexWriter; it compresses
the float returned by lengthNorm into a representation that uses a single
byte, and writes it to a file (one per field) which is exposed by
IndexReader.norms(field) for use in the Scorers.

:          NORM_TABLE[i] = 1.0f; //Originally: NORM_TABLE[i] =
: SmallFloat.byte315ToFloat((byte)i);

that norm table is just used as a cache of mappings from the "byte
encoded" values to the nearest float value so that Scorers don't need to
call SmallFloat.byte315ToFloat((byte)i) everytime.

If you use Similarity.setDefault (or IndexWriter.setSimilarity) before
building your index you shouldn't need that change.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message