lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Smith <>
Subject Issue with Similarity and negative numbers
Date Mon, 01 Sep 2003 14:32:37 GMT
Hi Luceners!

I am misusing the document score for date sorting (I display news
headlines in a chronological list).

As the document score is ultimately encoded as a byte the maximum
possible number of values is 256 minus the special value of 0
(document not found).

In the current implementation; all negative float values get
rounded up to zero by Similarity.floatToByte() and the method
Similarity.byteToFloat() returns only values in the range of
1 to 127 values that are greater than the decode for the
next lower byte value.

Similarity.byteToFloat(byteVal+1) > Similarity.byteToFloat(byteVal)

For my application having 255 possible scores from searches was better
than 127 so....

I have patched the Similarity class to encode negative floats into
the negative byte values and to decode the negative byte values back
into negative floats.

The encoding of the positive values are unchanged by this patch.

Could this version please be checked into CVS by someone with commit
rights?  Or is there are a more formal procedure to submitting patches,
say via the Bugzilla?

Many Thanks,

Nick Smith

View raw message