joined-search-fix
This commit is contained in:
parent
6116254d9f
commit
7e4aa83b8e
|
@ -4,6 +4,7 @@ from sqlalchemy.sql.expression import and_, asc, case, desc, func, nulls_last, s
|
||||||
from starlette.exceptions import HTTPException
|
from starlette.exceptions import HTTPException
|
||||||
|
|
||||||
from orm.author import Author, AuthorFollower
|
from orm.author import Author, AuthorFollower
|
||||||
|
from orm.community import Community
|
||||||
from orm.reaction import Reaction, ReactionKind
|
from orm.reaction import Reaction, ReactionKind
|
||||||
from orm.shout import Shout, ShoutAuthor, ShoutTopic, ShoutVisibility
|
from orm.shout import Shout, ShoutAuthor, ShoutTopic, ShoutVisibility
|
||||||
from orm.topic import Topic, TopicFollower
|
from orm.topic import Topic, TopicFollower
|
||||||
|
@ -338,6 +339,9 @@ async def load_shouts_search(_, _info, text, limit=50, offset=0):
|
||||||
joinedload(Shout.communities),
|
joinedload(Shout.communities),
|
||||||
)
|
)
|
||||||
.select_from(Shout)
|
.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(
|
.where(
|
||||||
and_(Shout.deleted_at.is_(None), Shout.slug.in_(results_dict.keys()))
|
and_(Shout.deleted_at.is_(None), Shout.slug.in_(results_dict.keys()))
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user