[Zope-CVS] CVS: Products/ZCTextIndex - Index.py:1.1.2.36
Fred L. Drake, Jr.
fdrake@acm.org
Tue, 7 May 2002 11:37:49 -0400
Update of /cvs-repository/Products/ZCTextIndex
In directory cvs.zope.org:/tmp/cvs-serv17808
Modified Files:
Tag: TextIndexDS9-branch
Index.py
Log Message:
search(): Do no re-compute something that should be a constant on each
trip around the loop; save it in a local before the loop starts.
=== Products/ZCTextIndex/Index.py 1.1.2.35 => 1.1.2.36 ===
N = float(len(self._docweight))
L = []
+ DictType = type({})
for wid in wids:
d2w = self._wordinfo[wid] # maps docid to w(docid, wid)
idf = query_term_weight(len(d2w), N) # this is an unscaled float
#print "idf = %.3f" % idf
- if isinstance(d2w, type({})):
+ if isinstance(d2w, DictType):
d2w = IIBucket(d2w)
L.append((d2w, scaled_int(idf)))
L.sort(lambda x, y: cmp(len(x[0]), len(y[0])))