[Zope-CVS] CVS: Products/ZCTextIndex - BaseIndex.py:1.21
Tim Peters
tim.one@comcast.net
Mon, 27 May 2002 00:43:37 -0400
Update of /cvs-repository/Products/ZCTextIndex
In directory cvs.zope.org:/tmp/cvs-serv29280
Modified Files:
BaseIndex.py
Log Message:
_del_wordinfo: compute the length only once; BTree len can be arbitrarily
expensive.
=== Products/ZCTextIndex/BaseIndex.py 1.20 => 1.21 ===
doc2score = self._wordinfo[wid]
del doc2score[docid]
- if len(doc2score) == 0:
+ numdocs = len(doc2score)
+ if numdocs == 0:
del self._wordinfo[wid]
return
- if len(doc2score) == self.DICT_CUTOFF:
+ if numdocs == self.DICT_CUTOFF:
new = {}
for k, v in doc2score.items():
new[k] = v