def _metadatafilter_to_dict(self, filter: MetadataFilter) -> Dict:
        """
        Parse MetadataFilter into a dictionary.

        Args:
            filter (MetadataFilter): A MetadataFilter object.

        Returns:
            dict: A dictionary representing the filter.

        """
        operator = filter.operator

        range_operators = {
            FilterOperator.GTE: "gte",
            FilterOperator.LTE: "lte",
            FilterOperator.GT: "gt",
            FilterOperator.LT: "lt",
        }

        if operator in range_operators:
            filter_dict = {
                "range": {filter.key: {range_operators[operator]: filter.value}}
            }
        elif operator == FilterOperator.EQ:
            filter_dict = {"term": {filter.key: filter.value}}
        else:
            raise ValueError(f"Unsupported filter operator: {operator}")

        return filter_dict

        Parse MetadataFilter into a dictionary.

        Args:
            filter (MetadataFilter): A MetadataFilter object.

        Returns:
            dict: A dictionary representing the filter.

        
llama-index-integrations/vector_stores/llama-index-vector-stores-lindorm/llama_index/vector_stores/lindorm/base.py