search-query-fix-4
All checks were successful
deploy / deploy (push) Successful in 1m29s

This commit is contained in:
Untone 2023-12-25 04:52:40 +03:00
parent d528da9b4a
commit c76e1625f3

View File

@ -300,11 +300,10 @@ async def load_shouts_search(_, _info, text, limit=50, offset=0):
with local_session() as session:
results = session.execute(q).unique()
# Assuming Shout has a score attribute, you can update each result with the score
for result in results:
shout_slug = result[0].slug # Assuming id is the primary key of Shout
shout_slug = result.get("slug")
score = results_dict.get(shout_slug, {}).get("score", 0)
setattr(result[0], "score", score)
result["score"] = score
return results
else: