diff options
author | Cédric Bonhomme <kimble.mandel@gmail.com> | 2013-06-25 07:14:33 +0200 |
---|---|---|
committer | Cédric Bonhomme <kimble.mandel@gmail.com> | 2013-06-25 07:14:33 +0200 |
commit | 0a7dfb1c934ce29c09df31d3462a5113027d0cf4 (patch) | |
tree | e224260cec84db24a98da89fb2915ea59d3e3af2 /source/pyAggr3g470r.py | |
parent | Added a button to reindex the database on the /search page. (diff) | |
download | newspipe-0a7dfb1c934ce29c09df31d3462a5113027d0cf4.tar.gz newspipe-0a7dfb1c934ce29c09df31d3462a5113027d0cf4.tar.bz2 newspipe-0a7dfb1c934ce29c09df31d3462a5113027d0cf4.zip |
Test if the database has not been indexed.
Diffstat (limited to 'source/pyAggr3g470r.py')
-rwxr-xr-x | source/pyAggr3g470r.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/pyAggr3g470r.py b/source/pyAggr3g470r.py index 4f006571..07782924 100755 --- a/source/pyAggr3g470r.py +++ b/source/pyAggr3g470r.py @@ -48,6 +48,7 @@ import time import datetime from collections import defaultdict +from whoosh.index import EmptyIndexError import cherrypy from mako.template import Template @@ -170,7 +171,10 @@ class pyAggr3g470r(object): if param == "Feed": feed_id, _, query = value.partition(':') search_result = defaultdict(list) - results = search.search(param) + try: + results = search.search(param) + except EmptyIndexError as e: + return self.error('<p>The database has not been <a href="/index_base">indexed</a>.</p>') for result in results: article = self.mongo.get_articles(result[0], result[1]) search_result[result[0]].append(article) |