[Zope3-checkins] SVN: Zope3/trunk/src/zope/index/text/ also dont
write when unindexing a not existing doc
Bernd Dorn
bernd.dorn at lovelysystems.com
Wed Apr 4 13:03:35 EDT 2007
Log message for revision 74007:
also dont write when unindexing a not existing doc
Changed:
U Zope3/trunk/src/zope/index/text/okapiindex.py
U Zope3/trunk/src/zope/index/text/textindex.txt
-=-
Modified: Zope3/trunk/src/zope/index/text/okapiindex.py
===================================================================
--- Zope3/trunk/src/zope/index/text/okapiindex.py 2007-04-04 17:02:37 UTC (rev 74006)
+++ Zope3/trunk/src/zope/index/text/okapiindex.py 2007-04-04 17:03:35 UTC (rev 74007)
@@ -235,6 +235,8 @@
return count
def unindex_doc(self, docid):
+ if docid not in self._docwords:
+ return
self._totaldoclen -= self._docweight.get(docid, 0)
BaseIndex.unindex_doc(self, docid)
Modified: Zope3/trunk/src/zope/index/text/textindex.txt
===================================================================
--- Zope3/trunk/src/zope/index/text/textindex.txt 2007-04-04 17:02:37 UTC (rev 74006)
+++ Zope3/trunk/src/zope/index/text/textindex.txt 2007-04-04 17:03:35 UTC (rev 74007)
@@ -150,3 +150,16 @@
>>> index.index_doc(100, u"an even newer funky value")
>>> index.index._p_changed
True
+
+The same as for index_doc applies to unindex_doc, if an object is
+unindexed that is not indexed no indexes chould change state.
+
+ >>> index._p_changed = index.index._p_changed = False
+ >>> index.unindex_doc(100)
+ >>> index.index._p_changed
+ True
+
+ >>> index._p_changed = index.index._p_changed = False
+ >>> index.unindex_doc(100)
+ >>> index._p_changed is index.index._p_changed is False
+ True
More information about the Zope3-Checkins
mailing list