[Zope-Checkins] CVS: Zope/lib/python/Products/ZCTextIndex - BaseIndex.py:1.28.6.1

Casey Duncan casey@zope.com
Wed, 26 Feb 2003 12:06:05 -0500


Update of /cvs-repository/Zope/lib/python/Products/ZCTextIndex
In directory cvs.zope.org:/tmp/cvs-serv5727/lib/python/Products/ZCTextIndex

Modified Files:
      Tag: Zope-2_6-branch
	BaseIndex.py 
Log Message:
Backport unindex performace fix for ZCTextIndex


=== Zope/lib/python/Products/ZCTextIndex/BaseIndex.py 1.28 => 1.28.6.1 ===
--- Zope/lib/python/Products/ZCTextIndex/BaseIndex.py:1.28	Wed Aug 14 18:25:14 2002
+++ Zope/lib/python/Products/ZCTextIndex/BaseIndex.py	Wed Feb 26 12:06:04 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,