aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rwxr-xr-xsource/pyAggr3g470r.py6
-rw-r--r--source/search.py2
-rw-r--r--source/static/templates/search.html3
3 files changed, 7 insertions, 4 deletions
diff --git a/source/pyAggr3g470r.py b/source/pyAggr3g470r.py
index f065b871..4f006571 100755
--- a/source/pyAggr3g470r.py
+++ b/source/pyAggr3g470r.py
@@ -169,7 +169,11 @@ class pyAggr3g470r(object):
feed_id = None
if param == "Feed":
feed_id, _, query = value.partition(':')
- search_result = self.mongo.full_search(param)
+ search_result = defaultdict(list)
+ results = search.search(param)
+ for result in results:
+ article = self.mongo.get_articles(result[0], result[1])
+ search_result[result[0]].append(article)
tmpl = lookup.get_template("search.html")
return tmpl.render(search_result=search_result, query=query, feed_id=feed_id, mongo=self.mongo)
diff --git a/source/search.py b/source/search.py
index 218d2436..2b0fea85 100644
--- a/source/search.py
+++ b/source/search.py
@@ -71,7 +71,7 @@ def search(term):
with ix.searcher() as searcher:
query = QueryParser("content", ix.schema).parse(term)
results = searcher.search(query)
- return [article['title'] for article in results]
+ return [(article["feed_id"], article["article_id"]) for article in results]
if __name__ == "__main__":
# Point of entry in execution mode.
diff --git a/source/static/templates/search.html b/source/static/templates/search.html
index da766ee9..9a635935 100644
--- a/source/static/templates/search.html
+++ b/source/static/templates/search.html
@@ -5,7 +5,7 @@ import utils
%>
<div class="left inner">
%if len(search_result) != 0:
- <h1>Articles containing the string <i>${query}</i> (${sum([articles.count() for articles in search_result.values()])} results)</h1>
+ <h1>Articles containing the string <i>${query}</i> (${sum([len(articles) for articles in search_result.values()])} results)</h1>
%else:
<h1>String <i>${query}</i> not found.</h1>
%endif
@@ -18,7 +18,6 @@ import utils
<%
new_feed_section = True
feed = mongo.get_feed(feed_id)
- print(search_result[feed["feed_id"]].count())
for article in search_result[feed["feed_id"]]:
if new_feed_section is True:
new_feed_section = False
bgstack15