Efficient way to make filters with multiple operands

Hi, I am trying to make filters to query with multiple operands using python v4 client. I am combining different filters to make a combined filter at runtime.

for single_filter in filters:
combined_filters = combined_filters & single_filter if combined_filters else single_filter

I want to add more operands to the filter. Is there any efficient way to make the filters at runtime?

Hi @Jegadeesh !!

I have used this code sample for creating dynamic filters on coderun:

Let me know if this is something you are looking for:

filter_metal = True

filters = [
    (Filter("count").greater_than(5) & Filter("count").less_than(10))

if filter_metal:

combined_filter = reduce(lambda x, y: x & y, filters)

from weaviate.classes import Filter

jeopardy = client.collections.get("Question")
response = jeopardy.query.fetch_objects(