Fix search for uncached entries (#323)

This commit is contained in:
Igor Chubin 2022-04-18 16:33:00 +00:00
parent 717f89e0c2
commit 742dd9f452

View file

@ -103,6 +103,11 @@ def find_answers_by_keyword(directory, keyword, options="", request_options=None
answer_dicts = get_answers(topic, request_options=request_options)
for answer_dict in answer_dicts:
answer_text = answer_dict.get('answer', '')
# Temporary hotfix:
# In some cases answer_text may be 'bytes' and not 'str'
if type(b"") == type(answer_text):
answer_text = answer_text.decode("utf-8")
if match(answer_text, keyword, options_dict=options_dict):
answers_found.append(answer_dict)