lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <cutt...@lucene.com>
Subject Re: Similarity.encodeNorm() / decodeNorm() funny.
Date Fri, 24 Jan 2003 18:33:35 GMT
Looks like a bug.  I just patched Similarity.java to fix this.

Doug


Nick Smith wrote:
> Hi Luceners,
>    I'm (mis)using the field normalisation factor for my own
> sorting purposes.  I create a sorting indicator as a byte
> value and use Similarity.decodeNorm() to create the float
> value suitable and have encounter the following :
> 
> I made the assumption that
> 
>   encodeNorm(decodeNorm(abyte)) == abyte
> 
> i.e. it is reflexive function.
> 
> However the assumption is value for values 1-7 (values
> -128 to 0 and 1 to 127 are as expected) - see below...
> 
> in = 0 float = 0.0 out = 0
> in = 1 float = 5.820766E-10 out = 8
> in = 2 float = 6.9849193E-10 out = 8
> in = 3 float = 8.1490725E-10 out = 8
> in = 4 float = 9.313226E-10 out = 8
> in = 5 float = 1.1641532E-9 out = 8
> in = 6 float = 1.3969839E-9 out = 8
> in = 7 float = 1.6298145E-9 out = 8
> in = 8 float = 1.8626451E-9 out = 8
> in = 9 float = 2.3283064E-9 out = 9
> 
> Now that I know of this "feature" I can workaround it
> but using only the range 9-127 (which is enough in my
> case).
> 
> I've posted this because it has caused a mistifying
> problem in our product and others _might_ be encountering
> the same "feature".
> 
> Many Thanks for the work people do on Lucene!!!
> 
> Cheers,
> 
> Nick
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>


Mime
View raw message