diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-05-03 07:47:10 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-05-03 07:47:10 +0200 |
commit | 6923cc7b852afcb672dcbed41e15443647988da6 (patch) | |
tree | eaab3342f9bac494542137d737d40d38b43d520d | |
parent | Bugfix. (diff) | |
download | newspipe-6923cc7b852afcb672dcbed41e15443647988da6.tar.gz newspipe-6923cc7b852afcb672dcbed41e15443647988da6.tar.bz2 newspipe-6923cc7b852afcb672dcbed41e15443647988da6.zip |
search.path fixes #5.
-rw-r--r-- | pyaggr3g470r/search.py | 7 |
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) |