def _parse_filters_recursively(
        self, filters: MetadataFilters
    ) -> tablestore.BoolQuery:
        """Parse (possibly nested) MetadataFilters to equivalent tablestore search expression."""
        bool_query = tablestore.BoolQuery(
            must_queries=[],
            must_not_queries=[],
            filter_queries=[],
            should_queries=[],
            minimum_should_match=None,
        )
        if filters.condition is FilterCondition.AND:
            bool_clause = bool_query.must_queries
        elif filters.condition is FilterCondition.OR:
            bool_clause = bool_query.should_queries
        else:
            raise ValueError(f"Unsupported filter condition: {filters.condition}")

        for filter_item in filters.filters:
            if isinstance(filter_item, MetadataFilter):
                bool_clause.append(self._parse_filter(filter_item))
            elif isinstance(filter_item, MetadataFilters):
                bool_clause.append(self._parse_filters_recursively(filter_item))
            else:
                raise ValueError(f"Unsupported filter type: {type(filter_item)}")

        return bool_query
Parse (possibly nested) MetadataFilters to equivalent tablestore search expression.
llama-index-integrations/vector_stores/llama-index-vector-stores-tablestore/llama_index/vector_stores/tablestore/base.py