def test_unindex_find_keys_pointing_to_rid(self): mock = Mock() mock.foo = 'a key' index = UnIndex('foo') index.index_object(-12, mock) self.assertItemsEqual(['a key'], find_keys_pointing_to_rid(index, -12))
def unindex_object(self, documentId): """ Unindex the object with integer id 'documentId' and don't raise an exception if we fail """ try: for lang in self.languages: self._v_lang = lang UnIndex.unindex_object(self, documentId) finally: self._v_lang = None
def __init__(self, id, ignore_ex=None, call_methods=None, extra=None, caller=None): """ Initialize the index @ param extra.recurdef: @ param extral.until: """ UnIndex.__init__(self, id, ignore_ex=None, call_methods=None, extra=None, caller=None) self.attr_recurdef = extra.recurdef self.attr_until = extra.until
def index_object(self, documentId, obj, threshold=None): """ wrapper to handle indexing of multiple attributes """ res = 0 for lang in self.languages: self._v_lang = lang res += UnIndex.index_object(self, documentId, obj, threshold) self._v_lang = None return res > 0
def __init__(self, id, ignore_ex=None, call_methods=None, extra=None, caller=None): UnIndex.__init__(self, id, ignore_ex=None, call_methods=None, extra=None, caller=None) self.caller = caller if extra is None: return try: self.startindex = extra.startindex self.endindex = extra.endindex except AttributeError: try: # alternative: allow a dict (lowers bootstrapping effort # from code) self.startindex = extra['startindex'] self.endindex = extra['endindex'] except AttributeError: raise ValueError( 'DateRangeInRangeIndex needs \'extra\' kwarg with keys or ' 'attributes \'startindex\' and \'endindex\' ' 'pointing to two existing DateIndex\'es.' )
def uniqueValues(self, name=None, withLengths=0, lang=None): if lang: self._v_lang = lang results = UnIndex.uniqueValues(self, name, withLengths) self._v_lang = None return results