Skip to content

Commit 52c49c0

Browse files
committed
Fix passed search params
1 parent f716dcf commit 52c49c0

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

api/app/importing.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,16 @@ async def get_articles(
1919
"""
2020
Fetch relevant articles from Diffbot KG endpoint
2121
"""
22+
search_query = 'query=type%3AArticle+strict%3Alanguage%3A"en"+sortBy%3Adate'
23+
if query:
24+
search_query += f'+text%3A"{query}"'
25+
if tag:
26+
search_query += f'+tags.label%3A"{tag}"'
27+
28+
params = {"query": query, "size": size, "offset": offset}
29+
2230
try:
23-
search_query = 'query=type%3AArticle+strict%3Alanguage%3A"en"+sortBy%3Adate'
24-
if query:
25-
search_query += f'+text%3A"{query}"'
26-
if tag:
27-
search_query += f'+tags.label%3A"{tag}"'
28-
response = await client.search({query: query, size: size, offset: offset})
31+
response = await client.search(params)
2932
return response.entities
3033
except Exception as ex:
3134
raise ex

0 commit comments

Comments
 (0)