[Zope-CVS] CVS: Products/ZCTextIndex/tests - testZCTextIndex.py:1.1.2.9
Tim Peters
tim.one@comcast.net
Fri, 3 May 2002 18:17:38 -0400
Update of /cvs-repository/Products/ZCTextIndex/tests
In directory cvs.zope.org:/tmp/cvs-serv25562/tests
Modified Files:
Tag: TextIndexDS9-branch
testZCTextIndex.py
Log Message:
In the maps storing (docid, weight) pairs, the weights have been scaled
ints representing 1.+log(count). This checkin changes the weights to
store the count directly instead when it's < 256. This requires
compensating hair upon both storing and loading weights. The payoff
is that virtually all counts are < 256, and a binary pickle can save
such a count in 1 byte, while a weight generally consumes 2 bytes.
Hmm. Because a pickle stores a typecode too, it's really a reduction
from 3 bytes to 2 for most weights. Maybe it's not worth the bother --
it does slow _get_frequencies by introducing irregularities.
=== Products/ZCTextIndex/tests/testZCTextIndex.py 1.1.2.8 => 1.1.2.9 ===
from Products.ZCTextIndex.tests \
import testIndex, testQueryEngine, testQueryParser
-from Products.ZCTextIndex.Index import scaled_int
+from Products.ZCTextIndex.Index import scaled_int, SCALE_FACTOR
import unittest
@@ -107,7 +107,7 @@
d[doc] = scaled_int(score)
for doc, score in r:
score = scaled_int(float(score) / wq)
- self.assert_(0 <= score <= 1024)
+ self.assert_(0 <= score <= SCALE_FACTOR)
eq(d[doc], score)
class QueryTests(testQueryEngine.TestQueryEngine,