Changeset - d5ab6db3b9e2
[Not reviewed]
default
0 2 0
Mads Kiilerich - 7 years ago 2018-12-23 21:16:07
mads@kiilerich.com
search: better messaging when the index hasn't been built yet

Improve the situation around the "Please run whoosh indexer" message.

1. It is not a situation that justifies logging a stack trace.
2. Don't just say "whoosh indexer" - it actually has a name: kallithea-cli index-create .
3. Don't report server side commands in the user interface.
2 files changed with 3 insertions and 6 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/search.py
Show inline comments
 
@@ -136,10 +136,8 @@ class SearchController(BaseRepoControlle
 
                    c.runtime = _('Invalid search query. Try quoting it.')
 
                searcher.close()
 
            except EmptyIndexError:
 
                log.error(traceback.format_exc())
 
                log.error('Empty Index data')
 
                c.runtime = _('There is no index to search in. '
 
                              'Please run whoosh indexer')
 
                log.error("Empty search index - run 'kallithea-cli index-create' regularly")
 
                c.runtime = _('The server has no search index.')
 
            except Exception:
 
                log.error(traceback.format_exc())
 
                c.runtime = _('An error occurred during search operation.')
kallithea/tests/functional/test_search.py
Show inline comments
 
@@ -24,8 +24,7 @@ class TestSearchController(TestControlle
 
        with mock.patch('kallithea.controllers.search.config', config_mock):
 
            response = self.app.get(url(controller='search', action='index'),
 
                                    {'q': HG_REPO})
 
            response.mustcontain('There is no index to search in. '
 
                                 'Please run whoosh indexer')
 
            response.mustcontain('The server has no search index.')
 

	
 
    def test_normal_search(self):
 
        self.log_user()
0 comments (0 inline, 0 general)