[Zope3-checkins] CVS: Zope3/src/zope/fieldindex - fieldindex.py:1.3

Andreas Jung andreas@andreas-jung.com
Wed, 26 Mar 2003 10:46:59 -0500


Update of /cvs-repository/Zope3/src/zope/fieldindex
In directory cvs.zope.org:/tmp/cvs-serv29236

Modified Files:
	fieldindex.py 
Log Message:
fixed problem when a document has been recataloged (raised by
ObjectHub). added test to check for this error


=== Zope3/src/zope/fieldindex/fieldindex.py 1.2 => 1.3 ===
--- Zope3/src/zope/fieldindex/fieldindex.py:1.2	Wed Mar 26 07:01:13 2003
+++ Zope3/src/zope/fieldindex/fieldindex.py	Wed Mar 26 10:46:28 2003
@@ -54,6 +54,9 @@
 
     def index_doc(self, docid, value):
 
+        if self.has_doc(docid):       # unindex doc if present
+            self.unindex_doc(docid)
+
         if not self._fwd_index.has_key(value):
             self._fwd_index[value] = IITreeSet()
 
@@ -67,7 +70,7 @@
             value = self._rev_index[docid]
         except KeyError: 
             return
-
+        
         del self._rev_index[docid]
 
         try: