[fix] split q on product'

This commit is contained in:
doman 2023-11-09 00:24:36 +01:00
parent 3fd0a76975
commit 31b035cb67

View file

@ -31,7 +31,11 @@ class Product(Base, CommonMixin):
query = select(cls) query = select(cls)
if q: if q:
query = query.filter(cls.name.ilike(f"%{q.lower()}%")) q_list = q.split()
for qq in q_list:
query = query.filter(
cls.name.ilike(f"%{qq.lower()}%")
)
query = query.offset(offset).limit(limit) query = query.offset(offset).limit(limit)
stream = await session.stream_scalars(query.order_by(cls.id)) stream = await session.stream_scalars(query.order_by(cls.id))