diff --git a/rhodecode/lib/indexers/__init__.py b/rhodecode/lib/indexers/__init__.py --- a/rhodecode/lib/indexers/__init__.py +++ b/rhodecode/lib/indexers/__init__.py @@ -40,7 +40,7 @@ from whoosh.index import create_in, open from whoosh.formats import Characters from whoosh.highlight import highlight, HtmlFormatter, ContextFragmenter -from webhelpers.html.builder import escape +from webhelpers.html.builder import escape, literal from sqlalchemy import engine_from_config from rhodecode.model import init_model @@ -57,6 +57,7 @@ ANALYZER = RegexTokenizer(expression=r"\ #INDEX SCHEMA DEFINITION SCHEMA = Schema( + fileid=ID(unique=True), owner=TEXT(), repository=TEXT(stored=True), path=TEXT(stored=True), @@ -93,6 +94,8 @@ class MakeIndex(BasePasterCommand): if self.options.repo_location else RepoModel().repos_path repo_list = map(strip, self.options.repo_list.split(',')) \ if self.options.repo_list else None + repo_update_list = map(strip, self.options.repo_update_list.split(',')) \ + if self.options.repo_update_list else None load_rcextensions(config['here']) #====================================================================== # WHOOSH DAEMON @@ -103,7 +106,8 @@ class MakeIndex(BasePasterCommand): l = DaemonLock(file_=jn(dn(dn(index_location)), 'make_index.lock')) WhooshIndexingDaemon(index_location=index_location, repo_location=repo_location, - repo_list=repo_list,)\ + repo_list=repo_list, + repo_update_list=repo_update_list)\ .run(full_index=self.options.full_index) l.release() except LockHeld: @@ -119,7 +123,14 @@ class MakeIndex(BasePasterCommand): action='store', dest='repo_list', help="Specifies a comma separated list of repositores " - "to build index on OPTIONAL", + "to build index on. If not given all repositories " + "are scanned for indexing. OPTIONAL", + ) + self.parser.add_option('--update-only', + action='store', + dest='repo_update_list', + help="Specifies a comma separated list of repositores " + "to re-build index on. OPTIONAL", ) self.parser.add_option('-f', action='store_true', @@ -220,7 +231,7 @@ class WhooshResultWrapper(object): if self.search_type != 'content': return '' hl = highlight( - text=escape(content), + text=content, terms=self.highlight_items, analyzer=ANALYZER, fragmenter=FRAGMENTER,