search-simpler-query-fix-2-3
All checks were successful
Deploy to core / deploy (push) Successful in 1m47s

This commit is contained in:
Untone 2024-01-28 23:42:35 +03:00
parent c061e5cdb3
commit 30a281a693

View File

@ -336,16 +336,21 @@ async def load_shouts_search(_, _info, text, limit=50, offset=0):
results_dict = {r['slug']: r for r in results}
found_keys = list(results_dict.keys())
q = select(Shout).where(
shouts_data = []
with local_session() as session:
results = (
session.query(Shout)
.where(
and_(
Shout.deleted_at.is_(None),
Shout.slug.in_(found_keys),
)
)
.limit(limit)
.offset(offset)
.all()
)
shouts_data = []
with local_session() as session:
results = set(session.execute(q).all())
# print(results)
logger.debug(f'search found {len(results)} results')
for x in results: