Logo Search packages:      
Sourcecode: zope-managableindex version File versions  Download package

def ManagableIndex::ManagableIndex::ManagableIndex::index_object (   self,
  documentId,
  obj,
  threshold = None 
)

index *obj* as *documentId*.

Commit subtransaction when *threshold* index terms have been indexed.
Return the number of index terms indexed.

Definition at line 233 of file ManagableIndex.py.

00233                                                       :
    '''index *obj* as *documentId*.

    Commit subtransaction when *threshold* index terms have been indexed.
    Return the number of index terms indexed.
    '''
    # Note: objPath should be provided by the catalog -- but it is not
    try: objPath = obj.getPhysicalPath()
    except: objPath = None
    __traceback_info__ = self.id, objPath

    val= self._evaluate(obj)

    # see whether something changed - do nothing, if it did not
    oldval= self._unindex.get(documentId)
    if val == oldval: return 0
    # some data types, e.g. "OOSet"s do not define a senseful "==".
    #  provide a hook to handle this case
    customEqual= self._equalValues
    if customEqual is not None and customEqual(val,oldval): return 0

    # remove state info
    update= self._update
    if update is None or oldval is None or val is None:
      # no optimization
      if oldval is not None: self._unindex_object(documentId,oldval,val is None)
      if val is None: return 0
      rv= self._indexValue(documentId,val,threshold)
      if oldval is None: self.numObjects.change(1)
    else:
      # optimization
      rv= update(documentId,val,oldval,threshold)
      if isinstance(rv, tuple): return rv[0]

    # remember indexed value
    self._unindex[documentId]= val
    return rv


  def unindex_object(self,documentId):


Generated by  Doxygen 1.6.0   Back to index