Skip to content

Commit

Permalink
Complete getCounter dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
andbag committed Apr 6, 2016
1 parent eea6bd0 commit b5d87fb
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/Products/PluginIndexes/BooleanIndex/BooleanIndex.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def clear(self):
self._index_value = 1
self._unindex = IIBTree()
self._length = BTrees.Length.Length()
self._counter = BTrees.Length.Length()

def histogram(self):
"""Return a mapping which provides a histogram of the number of
Expand Down Expand Up @@ -196,6 +197,7 @@ def unindex_object(self, documentId):
""" Unindex the object with integer id 'documentId' and don't
raise an exception if we fail
"""
self._increment_counter()
unindexRecord = self._unindex.get(documentId, _marker)
if unindexRecord is _marker:
return None
Expand Down
2 changes: 2 additions & 0 deletions src/Products/PluginIndexes/DateIndex/DateIndex.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def clear(self):
self._index = IOBTree()
self._unindex = IIBTree()
self._length = Length()
self._counter = Length()

def index_object(self, documentId, obj, threshold=None):
"""index an object, normalizing the indexed value to an integer
Expand All @@ -116,6 +117,7 @@ def index_object(self, documentId, obj, threshold=None):
o Objects which have 'None' as indexed value are *omitted*,
by design.
"""
self._increment_counter()
returnStatus = 0

try:
Expand Down
9 changes: 6 additions & 3 deletions src/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,20 @@ def getUntilField(self):

security.declareProtected(view, 'getFloorValue')
def getFloorValue(self):
""""""
""" """
return self.floor_value

security.declareProtected(view, 'getCeilingValue')
def getCeilingValue(self):
""""""
""" """
return self.ceiling_value

manage_indexProperties = DTMLFile('manageDateRangeIndex', _dtmldir)

security.declareProtected(manage_zcatalog_indexes, 'manage_edit')
def manage_edit(self, since_field, until_field, floor_value,
ceiling_value, REQUEST):
""""""
""" """
self._edit(since_field, until_field, floor_value, ceiling_value)
REQUEST['RESPONSE'].redirect('%s/manage_main'
'?manage_tabs_message=Updated'
Expand Down Expand Up @@ -154,6 +154,7 @@ def clear(self):
self._until = IOBTree()
self._unindex = IOBTree() # 'datum' will be a tuple of date ints
self._length = Length()
self._counter = Length()

def getEntryForObject(self, documentId, default=None):
"""Get all information contained for the specific object
Expand All @@ -169,6 +170,7 @@ def index_object(self, documentId, obj, threshold=None):
"""
if self._since_field is None:
return 0
self._increment_counter()

since = getattr(obj, self._since_field, None)
if safe_callable(since):
Expand Down Expand Up @@ -198,6 +200,7 @@ def index_object(self, documentId, obj, threshold=None):
def unindex_object(self, documentId):
"""Remove the object corresponding to 'documentId' from the index.
"""
self._increment_counter()
datum = self._unindex.get(documentId, None)
if datum is None:
return
Expand Down
1 change: 1 addition & 0 deletions src/Products/PluginIndexes/KeywordIndex/KeywordIndex.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ def unindex_objectKeywords(self, documentId, keywords):

def unindex_object(self, documentId):
""" carefully unindex the object with integer id 'documentId'"""
self._increment_counter()

keywords = self._unindex.get(documentId, None)
self.unindex_objectKeywords(documentId, keywords)
Expand Down
1 change: 1 addition & 0 deletions src/Products/PluginIndexes/UUIDIndex/UUIDIndex.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def clear(self):
self._length = Length()
self._index = OIBTree()
self._unindex = IOBTree()
self._counter = Length()

def numObjects(self):
"""Return the number of indexed objects. Since we have a 1:1 mapping
Expand Down

0 comments on commit b5d87fb

Please sign in to comment.