llama_index: [Bug]: Multiple MetaDataFilters not working even with a condition set.
Bug Description
query_engine = index.as_query_engine(
filters=MetadataFilters(
filters=[
MetadataFilter(
key="color",
value="red",
),
MetadataFilter(
key="alpha",
value="1",
),
],
condition=FilterCondition.OR,
)
Only when i use either of the filters it gives a index. When i do buth it returns:
Empty response
Version
0.9.44
Steps to Reproduce
Make a vectore store index and query it
index= VectorStoreIndex.from_vector_store(
vector_store=jobs_vector_store, service_context=service_context
)
Im using Qdrant.
Relevant Logs/Tracbacks
No response
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 4
- Comments: 17 (1 by maintainers)
🤖
Based on the context provided, it seems like you’re trying to use multiple
MetadataFilterswith aFilterCondition.ORcondition. This should return nodes that match any of the filters, not all of them. However, you mentioned that you’re getting an empty response.The code you’ve provided seems correct, but I suspect the issue might be with the data you’re querying. If there are no nodes that match either the “color” filter or the “alpha” filter, the query would indeed return an empty response.
Here’s a modified version of your code that should work as expected:
In this code, the
FilterCondition.ORcondition is used, meaning that the query will return nodes that match either the “color” filter or the “alpha” filter, not necessarily both.If you’re still getting an empty response, I would recommend checking the data you’re querying to ensure there are nodes that match either of the filters. You can do this by running separate queries for each filter and checking if they return any results.
For more information on how to use
MetadataFilterswith multiple filters and aFilterCondition.ORcondition, you can refer to the Qdrant metadata filter example in the LlamaIndex documentation.If you’re still having issues after trying these steps, please provide more information about the data you’re querying and I’ll be happy to help further.
Sources
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.
Somehow got it working after upgrading the qdrant image (v1.11.0) and llama-index (v0.11.1)
docker pull qdrant/qdrant:v1.11.0pip install llama-index-core>0.11.1 llama-index-vector-stores-qdrant>0.3.0 --upgradeExample usage: