lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "MH H" <mhh1...@gmail.com>
Subject Re: Overriding Similarity
Date Sun, 20 Aug 2006 00:43:39 GMT
Ah, I see, I should of course use the same similarity during indexing
and searching. Many thanks!

On 20/08/06, Chris Hostetter <hossman_lucene@fucit.org> wrote:
> : 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.
>
>
>
>
> -Hoss
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message