[Zope-Checkins] CVS: Zope/lib/python/Products/ZCTextIndex - BaseIndex.py:1.29
Casey Duncan
casey@zope.com
Tue, 4 Feb 2003 13:29:44 -0500
Update of /cvs-repository/Zope/lib/python/Products/ZCTextIndex
In directory cvs.zope.org:/tmp/cvs-serv1076
Modified Files:
BaseIndex.py
Log Message:
Merge unindex speed optimization from branch
=== Zope/lib/python/Products/ZCTextIndex/BaseIndex.py 1.28 => 1.29 ===
--- Zope/lib/python/Products/ZCTextIndex/BaseIndex.py:1.28 Wed Aug 14 18:25:14 2002
+++ Zope/lib/python/Products/ZCTextIndex/BaseIndex.py Tue Feb 4 13:29:41 2003
@@ -286,17 +286,11 @@
def _del_wordinfo(self, wid, docid):
doc2score = self._wordinfo[wid]
del doc2score[docid]
- numdocs = len(doc2score)
- if numdocs == 0:
+ if doc2score:
+ self._wordinfo[wid] = doc2score # not redundant: Persistency!
+ else:
del self._wordinfo[wid]
self.length.change(-1)
- return
- if numdocs == self.DICT_CUTOFF:
- new = {}
- for k, v in doc2score.items():
- new[k] = v
- doc2score = new
- self._wordinfo[wid] = doc2score # not redundant: Persistency!
def inverse_doc_frequency(term_count, num_items):
"""Return the inverse doc frequency for a term,