[Zope-Checkins]
SVN: Zope/branches/ajung-indexes-desuxing-branch/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py
added indexSize(), __len__()
Andreas Jung
andreas at andreas-jung.com
Tue Feb 1 10:11:27 EST 2005
Log message for revision 29010:
added indexSize(), __len__()
Changed:
U Zope/branches/ajung-indexes-desuxing-branch/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py
-=-
Modified: Zope/branches/ajung-indexes-desuxing-branch/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py
===================================================================
--- Zope/branches/ajung-indexes-desuxing-branch/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py 2005-02-01 14:58:49 UTC (rev 29009)
+++ Zope/branches/ajung-indexes-desuxing-branch/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py 2005-02-01 15:11:26 UTC (rev 29010)
@@ -113,7 +113,6 @@
comps = filter(None, path.split('/'))
if not self._unindex.has_key(docid):
- self._migrate_length()
self._length.change(1)
for i in range(len(comps)):
@@ -146,7 +145,6 @@
LOG.error('Attempt to unindex document with id %s failed'
% docid)
- self._migrate_length()
self._length.change(-1)
del self._unindex[docid]
@@ -200,15 +198,16 @@
return results
def numObjects(self):
+ """ return the number distinct values """
+ return len(self._unindex)
+
+ def indexSize(self):
""" return the number of indexed objects"""
- self._migrate_length()
+ return len(self)
+
+ def __len__(self):
return self._length()
- def _migrate_length(self):
- """ migrate index to use new _length attribute """
- if not hasattr(self, '_length'):
- self._length = Length(len(self._unindex))
-
def _apply_index(self, request, cid=''):
""" hook for (Z)Catalog
'request' -- mapping type (usually {"path": "..." }
More information about the Zope-Checkins
mailing list