search-simpler-query-fix-5
All checks were successful
Deploy to core / deploy (push) Successful in 1m41s
All checks were successful
Deploy to core / deploy (push) Successful in 1m41s
This commit is contained in:
parent
77114c66ec
commit
01b9091310
|
@ -340,7 +340,13 @@ async def load_shouts_search(_, _info, text, limit=50, offset=0):
|
||||||
with local_session() as session:
|
with local_session() as session:
|
||||||
results = (
|
results = (
|
||||||
session.query(Shout)
|
session.query(Shout)
|
||||||
.where(
|
.join(ShoutAuthor, Shout.id == ShoutAuthor.shout)
|
||||||
|
.join(ShoutTopic, Shout.id == ShoutTopic.shout)
|
||||||
|
.options(
|
||||||
|
joinedload(Shout.authors),
|
||||||
|
joinedload(Shout.topics),
|
||||||
|
)
|
||||||
|
.filter(
|
||||||
and_(
|
and_(
|
||||||
Shout.deleted_at.is_(None),
|
Shout.deleted_at.is_(None),
|
||||||
Shout.slug.in_(found_keys),
|
Shout.slug.in_(found_keys),
|
||||||
|
@ -348,10 +354,8 @@ async def load_shouts_search(_, _info, text, limit=50, offset=0):
|
||||||
)
|
)
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
.offset(offset)
|
.offset(offset)
|
||||||
.all()
|
.unique()
|
||||||
)
|
)
|
||||||
|
|
||||||
# print(results)
|
|
||||||
logger.debug(f'search found {len(results)} results')
|
logger.debug(f'search found {len(results)} results')
|
||||||
for shout in results:
|
for shout in results:
|
||||||
shout_data = shout.dict()
|
shout_data = shout.dict()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user