Find answers from the community

Updated 3 months ago

hey, i am using qdrant vector store

hey, i am using qdrant vector store index and have used metadata when indexing files, while retrieving i want to filter the nodes retrieved using the metadata supplied, but cant figure out any way to do this, i will be grateful if someone can help me this
L
S
6 comments
Plain Text
rom llama_index.core.vector_stores import (
    MetadataFilter,
    MetadataFilters,
    FilterOperator,
)

filters = MetadataFilters(
    filters=[
        MetadataFilter(
            key="theme", operator=FilterOperator.EQ, value="Fiction"
        ),
    ]
)


Then to use them
Plain Text
index.as_retriever(filters=filters).retrieve("query")
index.as_query_engine(filters=filters).query("query")
i am able to use this for EQ but this filtering is not working for IN when i am passing an array in value
can you help in this
You can just pass in the filters using qdrant syntax tbh, will be easier

Plain Text
index.as_query_engine(vector_store_kwargs={"qdrant_filters": <qdrant_syntax>}, ...)
here how do i need to input the qdrant filters? is it of the type cleint.scroll or model.Filter?
Attachment
image.png
got it, thanks for the help
Add a reply
Sign up and join the conversation on Discord