[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/common - PluggableIndex.py:1.7.4.1 UnIndex.py:1.14.4.5
Chris McDonough
chrism@zope.com
Fri, 3 Jan 2003 01:33:41 -0500
Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/common
In directory cvs.zope.org:/tmp/cvs-serv27194/PluginIndexes/common
Modified Files:
Tag: chrism-install-branch
PluggableIndex.py UnIndex.py
Log Message:
Merging chrism-install-branch with HEAD (hopefully for one of the last
times).
=== Zope/lib/python/Products/PluginIndexes/common/PluggableIndex.py 1.7 => 1.7.4.1 ===
--- Zope/lib/python/Products/PluginIndexes/common/PluggableIndex.py:1.7 Wed Aug 14 18:19:34 2002
+++ Zope/lib/python/Products/PluginIndexes/common/PluggableIndex.py Fri Jan 3 01:33:08 2003
@@ -11,7 +11,7 @@
#
##############################################################################
-"""Pluggable Index Base Class """
+"""Pluggable Index Interface"""
__version__='$Revision$'[11:-2]
import Interface
@@ -36,14 +36,6 @@
def unindex_object(documentId):
"""Remove the documentId from the index."""
- # XXX TextIndex does not implement uniqueValues().
- def uniqueValues(name=None, withLengths=0):
- """Returns the unique values for name.
-
- If 'withLengths' is true, returns a sequence of tuples of
- (value, length).
- """
-
def _apply_index(request, cid=''):
"""Apply the index to query parameters given in 'request'.
@@ -67,3 +59,34 @@
records. The second object is a tuple containing the names of
all data fields used.
"""
+
+ def numObjects():
+ """Return the number of indexed objects"""
+
+ def clear():
+ """Empty the index"""
+
+class UniqueValueIndex(PluggableIndexInterface):
+ """An index which can return lists of unique values contained in it"""
+
+ def hasUniqueValuesFor(name):
+ """Return true if the index can return the unique values for name"""
+
+ def uniqueValues(name=None, withLengths=0):
+ """Return the unique values for name.
+
+ If 'withLengths' is true, returns a sequence of tuples of
+ (value, length)."""
+
+class SortIndex(PluggableIndexInterface):
+ """An index which may be used to sort a set of document ids"""
+
+ def keyForDocument(documentId):
+ """Return the sort key that cooresponds to the specified document id
+
+ This method is no longer used by ZCatalog, but is left for backwards
+ compatibility."""
+
+ def documentToKeyMap():
+ """Return an object that supports __getitem__ and may be used to quickly
+ lookup the sort key given a document id"""
=== Zope/lib/python/Products/PluginIndexes/common/UnIndex.py 1.14.4.4 => 1.14.4.5 ===
--- Zope/lib/python/Products/PluginIndexes/common/UnIndex.py:1.14.4.4 Sun Nov 24 19:14:55 2002
+++ Zope/lib/python/Products/PluginIndexes/common/UnIndex.py Fri Jan 3 01:33:08 2003
@@ -383,7 +383,7 @@
return r, (self.id,)
def hasUniqueValuesFor(self, name):
- ' has unique values for column NAME '
+ """has unique values for column name"""
if name == self.id:
return 1
else:
@@ -413,11 +413,15 @@
else:
l = len(set)
rl.append((i, l))
- return tuple(rl)
+ return tuple(rl)
def keyForDocument(self, id):
+ # This method is superceded by documentToKeyMap
return self._unindex[id]
-
+
+ def documentToKeyMap(self):
+ return self._unindex
+
def items(self):
items = []
for k,v in self._index.items():