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

def ExtendedPathIndex::ExtendedPathIndex::ExtendedPathIndex::unindex_object (   self,
  docid 
)

hook for (Z)Catalog 

Definition at line 155 of file ExtendedPathIndex.py.

00155                                    :
        """ hook for (Z)Catalog """

        if not self._unindex.has_key(docid):
            logger.log(logging.INFO,
                       'Attempt to unindex nonexistent object with id '
                       '%s' % docid)
            return

        # There is an assumption that paths start with /
        path = self._unindex[docid]
        if not path.startswith('/'):
            path = '/'+path
        comps =  path.split('/')
        parent_path = '/'.join(comps[:-1])

        def unindex(comp, level, docid=docid, parent_path=None,
                                                            object_path=None):
            try:
                self._index[comp][level].remove(docid)

                if not self._index[comp][level]:
                    del self._index[comp][level]

                if not self._index[comp]:
                    del self._index[comp]
                # Remove parent_path and object path elements
                if parent_path is not None:
                    self._index_parents[parent_path].remove(docid)
                    if not self._index_parents[parent_path]:
                        del self._index_parents[parent_path]
                if object_path is not None:
                    del self._index_items[object_path]
            except KeyError:
                logger.log(logging.INFO,
                           'Attempt to unindex object with id '
                           '%s failed' % docid)

        for level in range(len(comps[1:])):
            comp = comps[level+1]
            unindex(comp, level)

        # Remove the terminator
        level = len(comps[1:])
        comp = None
        unindex(comp, level-1, parent_path=parent_path, object_path=path)

        self._length.change(-1)
        del self._unindex[docid]

    def search(self, path, default_level=0, depth=-1, navtree=0,


Generated by  Doxygen 1.6.0   Back to index