Stream: implementers
Topic: Search for resources with null field
Shlomy Reinstein (Feb 06 2017 at 11:56):
Can I search for a resource where a specific field of that resource is not specified? E.g. I want to find ReferralRequest resources where the 'supportingInformation' is empty (null)? Is there also a way to find the opposite (i.e. ReferralRequest resources whose 'supportingInformation' field is not null)
Vadim Peretokin (Feb 06 2017 at 12:01):
Yeah, see the :missing modifier: http://build.fhir.org/search.html#modifiers
Shlomy Reinstein (Feb 06 2017 at 12:10):
Thanks! Is this limited to resource fields that are supported in searching (specified under the "Search Parameters" section of each resource in the FHIR website) or does it work also for fields that you cannot normally search on?
Vadim Peretokin (Feb 06 2017 at 12:13):
I'd say the former. Given the language used: "Parameters are defined per resource. Parameter names may specify a modifier as a suffix.", and the fact that searchable fields are called "search parameters" on every resource, plus the fact that given certain (not all) servers designs I know, fields not mentioned by search parameters would not be indexed at all.
Lloyd McKenzie (Feb 06 2017 at 14:17):
You're free to define your own SearchParameter instances and use them on your server. But the :missing qualifier (and any qualifier) only works on search parameters your server actually supports.
Last updated: Apr 12 2022 at 19:14 UTC