From 7e4aa83b8e5ba3ab17136880c02c5e295100425c Mon Sep 17 00:00:00 2001 From: Untone Date: Fri, 26 Jan 2024 18:28:02 +0300 Subject: [PATCH] joined-search-fix --- resolvers/reader.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resolvers/reader.py b/resolvers/reader.py index 099888d8..6095bdcd 100644 --- a/resolvers/reader.py +++ b/resolvers/reader.py @@ -4,6 +4,7 @@ from sqlalchemy.sql.expression import and_, asc, case, desc, func, nulls_last, s from starlette.exceptions import HTTPException from orm.author import Author, AuthorFollower +from orm.community import Community from orm.reaction import Reaction, ReactionKind from orm.shout import Shout, ShoutAuthor, ShoutTopic, ShoutVisibility from orm.topic import Topic, TopicFollower @@ -338,6 +339,9 @@ async def load_shouts_search(_, _info, text, limit=50, offset=0): joinedload(Shout.communities), ) .select_from(Shout) + .join(Author, Shout.authors) # Ensure this join is not duplicated + .join(Topic, Shout.topics) # Ensure this join is not duplicated + .join(Community, Shout.communities) # Ensure this join is not duplicated .where( and_(Shout.deleted_at.is_(None), Shout.slug.in_(results_dict.keys())) )