Mercurial > kallithea
diff rhodecode/lib/indexers/daemon.py @ 2031:82a88013a3fd
merge 1.3 into stable
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sun, 26 Feb 2012 17:25:09 +0200 |
parents | bf263968da47 324ac367a4da |
children | dc2584ba5fbc |
line wrap: on
line diff
--- a/rhodecode/lib/indexers/daemon.py Sun Feb 19 20:21:14 2012 +0200 +++ b/rhodecode/lib/indexers/daemon.py Sun Feb 26 17:25:09 2012 +0200 @@ -7,7 +7,7 @@ :created_on: Jan 26, 2010 :author: marcink - :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> + :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com> :license: GPLv3, see COPYING for more details. """ # This program is free software: you can redistribute it and/or modify @@ -43,12 +43,12 @@ from rhodecode.lib import safe_unicode from rhodecode.lib.indexers import INDEX_EXTENSIONS, SCHEMA, IDX_NAME -from vcs.exceptions import ChangesetError, RepositoryError +from rhodecode.lib.vcs.exceptions import ChangesetError, RepositoryError, \ + NodeDoesNotExistError from whoosh.index import create_in, open_dir - log = logging.getLogger('whooshIndexer') # create logger log.setLevel(logging.DEBUG) @@ -67,12 +67,13 @@ # add ch to logger log.addHandler(ch) + class WhooshIndexingDaemon(object): """ Daemon for atomic jobs """ - def __init__(self, indexname='HG_INDEX', index_location=None, + def __init__(self, indexname=IDX_NAME, index_location=None, repo_location=None, sa=None, repo_list=None): self.indexname = indexname @@ -94,7 +95,6 @@ self.repo_paths = filtered_repo_paths - self.initial = False if not os.path.isdir(self.index_location): os.makedirs(self.index_location) @@ -154,7 +154,6 @@ modtime=self.get_node_mtime(node), extension=node.extension) - def build_index(self): if os.path.exists(self.index_location): log.debug('removing previous index') @@ -176,7 +175,6 @@ writer.commit(merge=True) log.debug('>>> FINISHED BUILDING INDEX <<<') - def update_index(self): log.debug('STARTING INCREMENTAL INDEXING UPDATE') @@ -198,7 +196,7 @@ try: node = self.get_node(repo, indexed_path) - except ChangesetError: + except (ChangesetError, NodeDoesNotExistError): # This file was deleted since it was indexed log.debug('removing from index %s' % indexed_path) writer.delete_by_term('path', indexed_path)