Find answers from the community

O
Omega
Offline, last seen 3 months ago
Joined September 25, 2024
Im trying to use MetadataFilters to retrieve documents from an index that have a date inside a given interval:

Plain Text
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?
14 comments
L
O
Ive made an issue
9 comments
O
L