aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2013-11-21 18:48:06 +0100
committerCédric Bonhomme <kimble.mandel@gmail.com>2013-11-21 18:48:06 +0100
commit4be4f98f70144fb1e1aaec6b8fa3033196e292b3 (patch)
tree9cdeaa288c77df6fe5d28243b98a7b75440b9e6c /pyaggr3g470r
parentNo need to sort the list of articles by date. (diff)
downloadnewspipe-4be4f98f70144fb1e1aaec6b8fa3033196e292b3.tar.gz
newspipe-4be4f98f70144fb1e1aaec6b8fa3033196e292b3.tar.bz2
newspipe-4be4f98f70144fb1e1aaec6b8fa3033196e292b3.zip
Added an option to index all the database.
Diffstat (limited to 'pyaggr3g470r')
-rw-r--r--pyaggr3g470r/search.py3
-rw-r--r--pyaggr3g470r/templates/management.html1
-rw-r--r--pyaggr3g470r/views.py10
3 files changed, 12 insertions, 2 deletions
diff --git a/pyaggr3g470r/search.py b/pyaggr3g470r/search.py
index 56aef3f6..4a8df1d9 100644
--- a/pyaggr3g470r/search.py
+++ b/pyaggr3g470r/search.py
@@ -47,11 +47,10 @@ schema = Schema(title=TEXT(stored=True), \
article_id=TEXT(stored=True), \
feed_id=TEXT(stored=True))
-def create_index():
+def create_index(feeds):
"""
Creates the index.
"""
- feeds = models.Feed.objects()
if not os.path.exists(indexdir):
os.makedirs(indexdir)
ix = create_in(indexdir, schema)
diff --git a/pyaggr3g470r/templates/management.html b/pyaggr3g470r/templates/management.html
index 61da8943..8647f2e3 100644
--- a/pyaggr3g470r/templates/management.html
+++ b/pyaggr3g470r/templates/management.html
@@ -5,6 +5,7 @@
<h1>Your subscriptions</h1>
<p>You are subscribed to {{ nb_feeds }} <a href="/feeds">feeds</a>. Add a <a href="/edit_feed/">feed</a>.</p>
<p>{{ nb_articles }} articles are stored in the database with {{ nb_unread_articles }} <a href="/unread/">unread articles</a>.</p>
+ <a href="/index_database/" class="btn btn-default">Index database</a>
</div>
</div><!-- /.container -->
{% endblock %} \ No newline at end of file
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index 991e25b0..1990633a 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -221,6 +221,16 @@ def inactives():
inactives.append((feed, elapsed))
return render_template('inactives.html', inactives=inactives, nb_days=nb_days)
+@app.route('/index_database/', methods=['GET'])
+@login_required
+def index_database():
+ """
+ Index all the database.
+ """
+ user = models.User.objects(email=g.user.email).first()
+ fastsearch.create_index(user.feeds)
+ return redirect(url_for('home'))
+
@app.route('/search/', methods=['GET'])
@login_required
def search():
bgstack15