Skip to content

Commit

Permalink
BUGFIX: if there are no results, return an empty set.
Browse files Browse the repository at this point in the history
  • Loading branch information
isazi committed Sep 3, 2019
1 parent f51e18a commit 241773f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions litstudy/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ def search_dblp(query, docs=None):
request = requests.get("http://dblp.org/search/publ/api?format=json&h=1000&f=0&q={}".format(query))
results = request.json()
expected_documents = int(results["result"]["hits"]["@total"])
if expected_documents == 0:
if docs:
return docs
else:
return DocumentSet(docs=documents)
return DocumentSet(docs=documents)
for paper in results["result"]["hits"]["hit"]:
retrieved_papers.append(paper)
while len(retrieved_papers) < expected_documents:
Expand Down

0 comments on commit 241773f

Please sign in to comment.