Package ca.uhn.fhir.jpa.dao.search


package ca.uhn.fhir.jpa.dao.search

Extended fhir indexing for Hibernate Search using Lucene/Elasticsearch.

By default, Lucene indexing only provides support for _text, and _content search parameters using ResourceTable.myNarrativeText and ResourceTable.myContentText. This package extends this search to support token, string, and reference parameters via ResourceTable.myLuceneIndexData. When active, the extracted search parameters which are written to the HFJ_SPIDX_* tables are also written to the Lucene index document. For now, we use the existing JPA index entities to populate the ExtendedHSearchIndexData in ExtendedHSearchIndexExtractor.extract(org.hl7.fhir.instance.model.api.IBaseResource, ca.uhn.fhir.jpa.searchparam.extractor.ResourceIndexedSearchParams) ()}

Implementation

SearchBuilder delegates the search to FulltextSearchSvcImpl.doSearch(java.lang.String, ca.uhn.fhir.jpa.searchparam.SearchParameterMap, ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId, java.lang.Integer) when active. The fulltext search runs first and interprets any search parameters it understands, returning a pid list. This pid list is used as a narrowing where clause against the remaining unprocessed search parameters in a jdbc query. The actual queries for the different search types (e.g. token, string, modifiers, etc.) are generated in ExtendedHSearchSearchBuilder.

Full resource bodies can be stored in the Hibernate Search index. The ExtendedHSearchResourceProjection is used to extract these. This is currently restricted to LastN, and misses tag changes from $meta-add and $meta-delete since those don't update Hibernate Search.

Operation

During startup, Hibernate Search uses SearchParamTextPropertyBinder to generate a schema.
See Also: