Im trying to use MetadataFilters to retrieve documents from an index that have a date inside a given interval:
start_date = start_date.strftime("%Y-%m-%d")
end_date = end_date.strftime("%Y-%m-%d")
filters = MetadataFilters(
filters=[
MetadataFilter(key="last_modified_date", operator=FilterOperator.GTE, value=start_date),
MetadataFilter(key="last_modified_date", operator=FilterOperator.LTE, value=end_date),
],
condition=FilterCondition.AND,
)
retriever = index.as_retriever(similarity_top_k=k, metadata_filters=filters)
documents = retriever.retrieve(query)
However, this is not working properly, as I am getting results of documents with dates outside the interval.
Why is this and how can I fix it?