aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2014-05-03 07:47:10 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2014-05-03 07:47:10 +0200
commit6923cc7b852afcb672dcbed41e15443647988da6 (patch)
treeeaab3342f9bac494542137d737d40d38b43d520d
parentBugfix. (diff)
downloadnewspipe-6923cc7b852afcb672dcbed41e15443647988da6.tar.gz
newspipe-6923cc7b852afcb672dcbed41e15443647988da6.tar.bz2
newspipe-6923cc7b852afcb672dcbed41e15443647988da6.zip
search.path fixes #5.
-rw-r--r--pyaggr3g470r/search.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/pyaggr3g470r/search.py b/pyaggr3g470r/search.py
index f4e57251..a7832c00 100644
--- a/pyaggr3g470r/search.py
+++ b/pyaggr3g470r/search.py
@@ -114,8 +114,9 @@ def search(user_id, term):
raise EmptyIndexError
with ix.searcher() as searcher:
query = QueryParser("content", ix.schema).parse(term)
- results = searcher.search(query, limit=None)
- for article in [item for item in results if item["user_id"] == user_id]:
+ user_doc = Term("user_id", user_id)
+ results = searcher.search(query, filter=user_doc, limit=None)
+ for article in results:
result_dict[article["feed_id"]].append(article["article_id"])
return result_dict, len(results)
@@ -136,4 +137,4 @@ if __name__ == "__main__":
print(nb_documents())
results = search("Nothomb")
for article in results:
- print(article) \ No newline at end of file
+ print(article)
bgstack15