[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/common
- UnIndex.py:1.20.2.1.8.1
Casey Duncan
casey at zope.com
Fri Apr 23 10:26:23 EDT 2004
Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/common
In directory cvs.zope.org:/tmp/cvs-serv21327/lib/python/Products/PluginIndexes/common
Modified Files:
Tag: casey-fix-index-numobjects-branch
UnIndex.py
Log Message:
Fix highly inefficient numObjects() method of "Unindex" variants.
Added test coverage for numObjects.
=== Zope/lib/python/Products/PluginIndexes/common/UnIndex.py 1.20.2.1 => 1.20.2.1.8.1 ===
--- Zope/lib/python/Products/PluginIndexes/common/UnIndex.py:1.20.2.1 Wed Nov 26 12:44:18 2003
+++ Zope/lib/python/Products/PluginIndexes/common/UnIndex.py Fri Apr 23 10:26:22 2004
@@ -141,9 +141,7 @@
def __len__(self):
"""Return the number of objects indexed.
- This method is only called for indexes which have "old" BTrees,
- and the *only* reason that UnIndexes maintain a __len__ is for
- the searching code in the catalog during sorting.
+ This method is overridden per-instance with a cached Length object
"""
return len(self._unindex)
@@ -288,7 +286,7 @@
def numObjects(self):
""" return number of indexed objects """
- return len(self._unindex)
+ return len(self)
def unindex_object(self, documentId):
More information about the Zope-Checkins
mailing list