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

def ExtendedPathIndex::ExtendedPathIndex::ExtendedPathIndex::unindex_object (   self,

hook for (Z)Catalog 

Definition at line 153 of file ExtendedPathIndex.py.

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

        if not self._unindex.has_key(docid):
            LOG(self.__class__.__name__, ERROR,
                'Attempt to unindex nonexistent document'
                ' with id %s' % docid)

        # 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,

                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:
                    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:
                LOG(self.__class__.__name__, ERROR,
                    'Attempt to unindex document'
                    ' 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)

        del self._unindex[docid]

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

Generated by  Doxygen 1.6.0   Back to index