Commit 5c1f5c85 authored by Hanno Schlichting's avatar Hanno Schlichting

Merged c106786 from 2.12 branch

parent 96e44cde
...@@ -316,27 +316,42 @@ class DateRangeIndex(UnIndex): ...@@ -316,27 +316,42 @@ class DateRangeIndex(UnIndex):
set = self._until_only.get( until, None ) set = self._until_only.get( until, None )
if set is None: if set is None:
set = self._until_only[ until ] = IISet() # XXX: Store an int? self._until_only[ until ] = documentId
set.insert( documentId ) else:
if isinstance(set, int):
set = self._until_only[ until ] = IISet((set, documentId))
else:
set.insert( documentId )
elif until is None: elif until is None:
set = self._since_only.get( since, None ) set = self._since_only.get( since, None )
if set is None: if set is None:
set = self._since_only[ since ] = IISet() # XXX: Store an int? self._since_only[ since ] = documentId
set.insert( documentId ) else:
if isinstance(set, int):
set = self._since_only[ since ] = IISet((set, documentId))
else:
set.insert( documentId )
else: else:
set = self._since.get( since, None ) set = self._since.get( since, None )
if set is None: if set is None:
set = self._since[ since ] = IISet() # XXX: Store an int? self._since[ since ] = documentId
set.insert( documentId ) else:
if isinstance(set, int):
set = self._since[ since ] = IISet((set, documentId))
else:
set.insert( documentId )
set = self._until.get( until, None ) set = self._until.get( until, None )
if set is None: if set is None:
set = self._until[ until ] = IISet() # XXX: Store an int? self._until[ until ] = documentId
set.insert( documentId ) else:
if isinstance(set, int):
set = self._until[ until ] = IISet((set, documentId))
else:
set.insert( documentId )
def _removeForwardIndexEntry( self, since, until, documentId ): def _removeForwardIndexEntry( self, since, until, documentId ):
""" """
...@@ -352,36 +367,50 @@ class DateRangeIndex(UnIndex): ...@@ -352,36 +367,50 @@ class DateRangeIndex(UnIndex):
set = self._until_only.get( until, None ) set = self._until_only.get( until, None )
if set is not None: if set is not None:
set.remove( documentId ) if isinstance(set, int):
del self._until_only[until]
else:
set.remove( documentId )
if not set: if not set:
del self._until_only[ until ] del self._until_only[ until ]
elif until is None: elif until is None:
set = self._since_only.get( since, None ) set = self._since_only.get( since, None )
if set is not None: if set is not None:
set.remove( documentId ) if isinstance(set, int):
if not set:
del self._since_only[ since ] del self._since_only[ since ]
else:
set.remove( documentId )
if not set:
del self._since_only[ since ]
else: else:
set = self._since.get( since, None ) set = self._since.get( since, None )
if set is not None: if set is not None:
set.remove( documentId )
if not set: if isinstance(set, int):
del self._since[ since ] del self._since[ since ]
else:
set.remove( documentId )
if not set:
del self._since[ since ]
set = self._until.get( until, None ) set = self._until.get( until, None )
if set is not None: if set is not None:
set.remove( documentId )
if not set: if isinstance(set, int):
del self._until[ until ] del self._until[ until ]
else:
set.remove( documentId )
if not set:
del self._until[ until ]
def _convertDateTime( self, value ): def _convertDateTime( self, value ):
if value is None: if value is None:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment