refactor(reader.py): Remove the unnecessary topic joins that cause duplicate results
All checks were successful
Deploy on push / deploy (push) Successful in 51s

This commit is contained in:
Stepan Vladovskiy 2025-04-01 12:57:46 -03:00
parent 9a02ca74ad
commit ecc443c3ad

View File

@ -417,12 +417,6 @@ async def load_shouts_search(_, info, text, options):
q = q.filter(Shout.id.in_(hits_ids)) q = q.filter(Shout.id.in_(hits_ids))
q = apply_filters(q, options) q = apply_filters(q, options)
# added this to join topics
topic_join = aliased(ShoutTopic)
topic = aliased(Topic)
q = q.outerjoin(topic_join, topic_join.shout == Shout.id)
q = q.outerjoin(topic, topic.id == topic_join.topic)
shouts = get_shouts_with_links(info, q, limit, offset) shouts = get_shouts_with_links(info, q, limit, offset)
for shout in shouts: for shout in shouts:
shout["score"] = scores[f"{shout['id']}"] shout["score"] = scores[f"{shout['id']}"]