# HG changeset patch # User Marcin Kuzminski # Date 2011-05-02 15:01:29 # Node ID 9773b46e239fad64c305522e9701f0e59771c9de # Parent f0e904651f217818144f68153d785b1eb59bf2e8 whoosh errors don't crash entire app now, just display an error and log exception instead diff --git a/rhodecode/controllers/search.py b/rhodecode/controllers/search.py --- a/rhodecode/controllers/search.py +++ b/rhodecode/controllers/search.py @@ -37,7 +37,7 @@ from webhelpers.util import update_param from whoosh.index import open_dir, EmptyIndexError from whoosh.qparser import QueryParser, QueryParserError -from whoosh.query import Phrase +from whoosh.query import Phrase, Wildcard, Term, Prefix log = logging.getLogger(__name__) @@ -79,6 +79,8 @@ class SearchController(BaseController): if isinstance(query, Phrase): highlight_items.update(query.words) + elif isinstance(query, Prefix): + highlight_items.add(query.text) else: for i in query.all_terms(): if i[0] == 'content': @@ -111,6 +113,9 @@ class SearchController(BaseController): log.error('Empty Index data') c.runtime = _('There is no index to search in. ' 'Please run whoosh indexer') + except (Exception): + log.error(traceback.format_exc()) + c.runtime = _('An error occurred during this search operation') # Return a rendered template return render('/search/search.html')