Changeset - 9773b46e239f
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 15 years ago 2011-05-02 15:01:29
marcin@python-works.com
whoosh errors don't crash entire app now, just display an error and log exception instead
1 file changed with 6 insertions and 1 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/search.py
Show inline comments
 
@@ -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')
0 comments (0 inline, 0 general)