Filtering objects based nested property

Here is an example of properties of an object {…
‘sectionName’: ‘introduction’,
‘title’: ‘Tuberculosis manifesting with significant peripheral eosinophilia: A case report and review of literature’,
‘publishingDate’: datetime.datetime(2023, 10, 23, 0, 0, tzinfo=datetime.timezone.utc),
‘journal’: ‘Clinical Case Reports’,
‘ids’: [{‘idValue’: ‘37881201’, ‘idName’: ‘PMID’},
{‘idValue’: ‘10.1002/ccr3.8085’, ‘idName’: ‘DOI’},
{‘idValue’: ‘PMC10593972’, ‘idName’: ‘PMCID’}]

Could you use Filter to obtain papers with PMID (e.g., ‘idValue’ = ‘37881201’)? Property of “ids” is a list. Contains_any does not seem to work with scenario like this.

pmid_filter = Filter.any_of([
Filter.by_property(“ids”).contains_any([{“idValue”: value, “idName”: “PMID”}])
for value in pmid_values
])

result = collection.fetch_objects(
filters=pmid_filter
)

I keep getting validation error like this:
value.int
Input should be a valid integer [type=int_type, input_value=[{‘idValue’: ‘35838824’, ‘idName’: ‘PMID’}], input_type=list]
For further information visit Redirecting...

Any suggestions?

Hello @zmliu213,

Welcome to our community. It’s great to have you here.

Please note that this is not a feature yet but it’s in our road map

Regards
Mohamed Shahin
Weaviate Support

1 Like