[fix] split q on product'
This commit is contained in:
parent
3fd0a76975
commit
31b035cb67
1 changed files with 5 additions and 1 deletions
|
@ -31,7 +31,11 @@ class Product(Base, CommonMixin):
|
|||
query = select(cls)
|
||||
|
||||
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)
|
||||
stream = await session.stream_scalars(query.order_by(cls.id))
|
||||
|
|
Loading…
Reference in a new issue