Find answers from the community

Updated 7 months ago

how to filter with either of following

how to filter with either of following categories
Plain Text
filters = [
                ("source", "file"),
                ("source", "url"),
                ("source", "twitter"),
            ]
Plain Text
from llama_index.core.vector_stores import MetadataFilters, MetadataFilter, FilterCondition

filters = MetadataFilters(
    filters=[
        MetadataFilter(key="source", value="file"),
        MetadataFilter(key="source", value="url"),
        MetadataFilter(key="source", value="twitter"),
    ],
    condition=FilterCondition.OR,
)

retriever = index.as_retriever(filters=filters)
retriever.retrieve("Your query here")


I am getting empty nodes list; what is supposed to be the issue; can anyone help?
thanks
L
s
5 comments
probably the vector db you are using doesn't support OR
i am using Vector Store Index
Right, but you can use that with any vector db (pinecone, weaviate, qdrant, etc.) Or the default, which is just in-memory
I don't think the default works with OR -- or at least, not until very recently. I cant remember if the lastest version released included that PR yet or not
I am referring to default vector store.
Is it something you can check or how to check it myslef?
Add a reply
Sign up and join the conversation on Discord