コード例 #1
0
 def _insert(self,term,docId, _isInstance= isinstance, _IntType= IntType):
   '''index *docId* under *term*.'''
   index= self._index
   dl= index.get(term)
   if dl is None:
     index[term]= docId; self.__len__.change(1)
     if self.ReverseOrder: self._reverseOrder.insert(reverseOrder(term))
     return
   if _isInstance(dl,_IntType): dl= index[term]= IITreeSet((dl,))
   dl.insert(docId)
コード例 #2
0
ファイル: ManagableIndex.py プロジェクト: c0ns0le/zenoss-4
 def _insert(self, term, docId, _isInstance=isinstance, _IntType=IntType):
     '''index *docId* under *term*.'''
     index = self._index
     dl = index.get(term)
     if dl is None:
         index[term] = docId
         self.__len__.change(1)
         if self.ReverseOrder: self._reverseOrder.insert(reverseOrder(term))
         return
     if _isInstance(dl, _IntType): dl = index[term] = IITreeSet((dl, ))
     dl.insert(docId)
コード例 #3
0
 def _remove(self,term,docId, _isInstance= isinstance, _IntType= IntType):
   '''unindex *docId* under *term*.'''
   index= self._index
   dl= index.get(term); isInt= _isInstance(dl,_IntType)
   if dl is None or isInt and dl != docId:
     raise ValueError('Attempt to remove nonexisting document %s from %s'
                      % (docId, self.id)
                      )
   if isInt: dl = None
   else: dl.remove(docId)
   if not dl:
     del index[term]; self.__len__.change(-1)
     if self.ReverseOrder: self._reverseOrder.remove(reverseOrder(term))
コード例 #4
0
ファイル: ManagableIndex.py プロジェクト: c0ns0le/zenoss-4
 def _remove(self, term, docId, _isInstance=isinstance, _IntType=IntType):
     '''unindex *docId* under *term*.'''
     index = self._index
     dl = index.get(term)
     isInt = _isInstance(dl, _IntType)
     if dl is None or isInt and dl != docId:
         raise ValueError(
             'Attempt to remove nonexisting document %s from %s' %
             (docId, self.id))
     if isInt: dl = None
     else: dl.remove(docId)
     if not dl:
         del index[term]
         self.__len__.change(-1)
         if self.ReverseOrder: self._reverseOrder.remove(reverseOrder(term))