aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pyaggr3g470r/search.py2
-rw-r--r--pyaggr3g470r/templates/search.html1
-rw-r--r--pyaggr3g470r/views.py4
3 files changed, 4 insertions, 3 deletions
diff --git a/pyaggr3g470r/search.py b/pyaggr3g470r/search.py
index 4a8df1d9..4b8602f7 100644
--- a/pyaggr3g470r/search.py
+++ b/pyaggr3g470r/search.py
@@ -111,7 +111,7 @@ def search(term):
results = searcher.search(query, limit=None)
for article in results:
result_dict[article["feed_id"]].append(article["article_id"])
- return result_dict
+ return result_dict, len(results)
def nb_documents():
"""
diff --git a/pyaggr3g470r/templates/search.html b/pyaggr3g470r/templates/search.html
index 93fe5062..e62cd45b 100644
--- a/pyaggr3g470r/templates/search.html
+++ b/pyaggr3g470r/templates/search.html
@@ -4,6 +4,7 @@
{% if feeds|count == 0 %}
<h1>No results.</h1>
{% else %}
+ <h1>{{ nb_articles }} {% if nb_articles !=1 %} results {% else %} result {% endif %} for <i>{{ query }}</i></h1>
{% for feed in feeds|sort(attribute="title") %}
<div class="row">
<div class="col-md-6 col-md-offset-3">
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index 98362d05..cdbc1a45 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -262,7 +262,7 @@ def search():
result = []
query = request.args.get('query', None)
if query != None:
- results = fastsearch.search(query)
+ results, nb_articles = fastsearch.search(query)
for feed_id in results:
for feed in user.feeds:
if str(feed.oid) == feed_id:
@@ -271,7 +271,7 @@ def search():
current_article = models.Article.objects(id=article_id).first()
feed.articles.append(current_article)
result.append(feed)
- return render_template('search.html', feeds=result)
+ return render_template('search.html', feeds=result, nb_articles=nb_articles, query=query)
@app.route('/management/', methods=['GET'])
@login_required
bgstack15