[Zope-Checkins]
CVS: Zope/lib/python/Products/PluginIndexes/TopicIndex
- TopicIndex.py:1.13.8.1
Andreas Jung
andreas at andreas-jung.com
Fri Aug 15 11:08:42 EDT 2003
Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/TopicIndex
In directory cvs.zope.org:/tmp/cvs-serv13177
Modified Files:
Tag: ajung-indexes-btrees-length-branch
TopicIndex.py
Log Message:
whitespace cleanup
=== Zope/lib/python/Products/PluginIndexes/TopicIndex/TopicIndex.py 1.13 => 1.13.8.1 ===
--- Zope/lib/python/Products/PluginIndexes/TopicIndex/TopicIndex.py:1.13 Mon Jun 23 04:45:58 2003
+++ Zope/lib/python/Products/PluginIndexes/TopicIndex/TopicIndex.py Fri Aug 15 10:08:30 2003
@@ -29,9 +29,9 @@
class TopicIndex(Persistent, Implicit, SimpleItem):
""" A TopicIndex maintains a set of FilteredSet objects.
- Every FilteredSet object consists of an expression and
- and IISet with all Ids of indexed objects that eval with
- this expression to 1.
+ Every FilteredSet object consists of an expression and
+ and IISet with all Ids of indexed objects that eval with
+ this expression to 1.
"""
__implements__ = (PluggableIndex.PluggableIndexInterface,)
@@ -51,11 +51,9 @@
def __init__(self,id,caller=None):
self.id = id
self.filteredSets = OOBTree()
- # experimental code for specifing the operator
self.operators = ('or','and')
self.defaultOperator = 'or'
-
def getId(self): return self.id
def clear(self):
@@ -64,13 +62,11 @@
for fs in self.filteredSets.values():
fs.clear()
-
def index_object(self, documentId, obj ,threshold=100):
""" hook for (Z)Catalog """
for fid, filteredSet in self.filteredSets.items():
filteredSet.index_object(documentId,obj)
-
return 1
@@ -78,7 +74,6 @@
""" hook for (Z)Catalog """
for fs in self.filteredSets.values():
-
try:
fs.unindex_object(documentId)
except KeyError:
@@ -87,7 +82,6 @@
' with id %s failed' % documentId)
return 1
-
def __len__(self):
""" len """
n=0
@@ -95,22 +89,17 @@
n = n + len(fs.getIds())
return n
-
def numObjects(self):
return "N/A"
-
def keys(self): pass
def values(self): pass
def items(self): pass
-
def search(self,filterId):
-
if self.filteredSets.has_key(filterId):
return self.filteredSets[filterId].getIds()
-
def _apply_index(self, request, cid=''):
""" hook for (Z)Catalog
request mapping type (usually {"topic": "..." }
@@ -125,7 +114,7 @@
# depending on the operator we use intersection of union
if operator=="or": set_func = union
- else: set_func = intersection
+ else: set_func = intersection
res = None
@@ -138,48 +127,37 @@
else:
return IISet(), (self.id,)
-
def uniqueValues(self,name=None,withLength=0):
""" needed to be consistent with the interface """
-
return self.filteredSets.keys()
-
def getEntryForObject(self,documentId,default=_marker):
""" Takes a document ID and returns all the information we have
- on that specific object. """
-
+ on that specific object.
+ """
return self.filteredSets.keys()
-
def addFilteredSet(self, filterId, typeFilteredSet, expr):
if self.filteredSets.has_key(filterId):
raise KeyError,\
'A FilteredSet with this name already exists: %s' % filterId
-
self.filteredSets[filterId] = \
FilteredSet.factory(filterId, typeFilteredSet, expr)
-
def delFilteredSet(self,filterId):
-
if not self.filteredSets.has_key(filterId):
raise KeyError,\
'no such FilteredSet: %s' % filterId
del self.filteredSets[filterId]
-
def clearFilteredSet(self,filterId):
-
if not self.filteredSets.has_key(filterId):
raise KeyError,\
'no such FilteredSet: %s' % filterId
-
self.filteredSets[filterId].clear()
-
def manage_addFilteredSet(self, filterId, typeFilteredSet, expr, URL1, \
REQUEST=None,RESPONSE=None):
""" add a new filtered set """
@@ -193,7 +171,6 @@
RESPONSE.redirect(URL1+'/manage_workspace?'
'manage_tabs_message=FilteredSet%20added')
-
def manage_delFilteredSet(self, filterIds=[], URL1=None, \
REQUEST=None,RESPONSE=None):
""" delete a list of FilteredSets"""
@@ -205,7 +182,6 @@
RESPONSE.redirect(URL1+'/manage_workspace?'
'manage_tabs_message=FilteredSet(s)%20deleted')
-
def manage_saveFilteredSet(self,filterId, expr, URL1=None,\
REQUEST=None,RESPONSE=None):
""" save expression for a FilteredSet """
@@ -219,7 +195,6 @@
def getIndexSourceNames(self):
""" return names of indexed attributes """
return ('n/a',)
-
def manage_clearFilteredSet(self, filterIds=[], URL1=None, \
REQUEST=None,RESPONSE=None):
More information about the Zope-Checkins
mailing list