In Qdrant DB I have a payload containing a list. How can I filter results of a search limiting to the ones where the list contain a specific element?
As example, if the set of points is:
[
{ "id": 1, "Fruit": ["apple", "banana", "orange"] },
{ "id": 2, "Fruit": ["pear", "orange" ] },
{ "id": 3, "test": "empty" },
{ "id": 4, "Fruit": ["apple", "orange", "pear"] }
]
And I want to filter the results containing at least an Apple AND an Orange, i.e. the ones with ID 1 and 4.
How can I build such filter?
I already had a look at the documentation at this link, without success.
In the docs there is no my case. What I tried is:
Filter(should=[FieldCondition(key='Fruit', match=MatchValue(value='Banana'), range=None, geo_bounding_box=None, geo_radius=None, values_count=None), FieldCondition(key='Fruit', match=MatchValue(value='Apple'), range=None, geo_bounding_box=None, geo_radius=None, values_count=None)], must=None, must_not=None)
But the result that I know is in the DB does not show up
Thank you in advance.
I created some dashboard console queries to setup your example.
Example setup
Create a fruit collection.
Create points in the fruit collection.
Search for points where payload includes "apple" and "orange" in "Fruit" field.
This translates to Python as: