redis / redis-om-python

Object mapping, and more, for Redis and Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how can I search by condition

saifullah-repliq opened this issue · comments

results = []
 
if name:
  results = BaseProductPy.find(BaseProductPy.name % f"{name}*")
 
if tags:
  results = results.find(BaseProductPy.tag.value == tags)
 
if city:
  results = results.find(BaseProductPy.address.city == city)
 
return results

how can i search by condition where if name is there, find by name. if tag is there, find by name and tag. If city is there, find by name, tag and city.

how can i do that?