Question: #FHIR Common Search Parameters
Feb 10, 2016Question:
I am working on fhir based rest server. I have already implemented create, delete, read, update, and history services. I am working on search service and i have some difficulties to understand what exactly do parameters mean especially common parameters. For example _text,_content,_list,_query. Can you give me more specified examples please?
Answer:
_text:
GET [base]/Condition?_text=(bone OR liver) and metastases
This example from the specification shows how you could search the xhtml content of the narrative for the word ‘metastases’ and either ‘bone’ or ‘liver’. The expectation is that your server will pass the narrative to an indexing engine (typically, either Lucene, Solr, or Microsoft SQL Text Indexer) and that when a search specifies the _text parameter, the parameter value will be passed to the search engine as is. The trick is integrating the search engine with the other search parameters, but solving that is out of scope for my blog.
_content:
This is nearly the same as the _text resource, except instead of the narrative, it searches the entire text of the resource - that is, the xhtml and all the primitive values. You have to assemble this yourself somehow and pass it to the search engine. I don’t think many implementers have done this one.
_list:
This is a short cut to allow you to search for resources that are in some list. There’s 2 main use cases for this - when a list is being used to track an ad-hoc selection of resources, such as a clinically interesting patient list, the _list parameter lets you search through only the items in that list. The other use is for EHRs or other clinical systems that maintain ‘current lists’, such as ‘current medication list’ or ‘current problem list’ - a way to search those current lists only.
_query:
This is for when the server wants to define it’s own search that works differently to the normal search. If the server sees a _query parameter, it cannot ignore it, since the parameters may not have the normal meaning. When a server defines it’s own kind of query, it can use the rest of the parameters however it wants. The FHIR specification defines one of these, for MPI Search