Ejemplo n.º 1
0
    def document_iterator(self, paths=False):
        """ Iterator yielding elements files in repo as indexable documents. """

        if not paths:
            # get all in repo
            paths = lib_repo.get_element_paths_iterator()

        for path in paths:
            try:
                document = lib_xml.get_element_metadata(path)
            except lib_xml.InvalidPathError as e:
                yield { 'path': e.path, 'deleted': True }
            else:
                document = self.whoosh_escape_document(document)
                yield document
Ejemplo n.º 2
0
    def document_iterator(self, paths=False):
        """ Iterator yielding elements files in repo as indexable documents. """

        if not paths:
            # get all in repo
            paths = lib_repo.get_element_paths_iterator()

        for path in paths:
            try:
                document = lib_xml.get_element_metadata(path)
            except lib_xml.InvalidPathError as e:
                yield {'path': e.path, 'deleted': True}
            except lib_xml.InvalidXmlError as e:
                raise
            else:
                document = self.whoosh_escape_document(document)
                yield document