
Package ca.uhn.fhir.jpa.dao
Class FulltextSearchSvcImpl
java.lang.Object
ca.uhn.fhir.jpa.dao.FulltextSearchSvcImpl
- All Implemented Interfaces:
IFulltextSearchSvc
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanUseHibernateSearch(String theResourceType, SearchParameterMap myParams) Returns true if the parameter map can be handled for hibernate search.longcount(String theResourceName, SearchParameterMap theParams) Returns accurate hit countvoiddeleteIndexedDocumentsByTypeAndId(Class theClazz, List<Object> theGivenIds) Given a resource type that is indexed by hibernate search, and a list of objects reprenting the IDs you wish to delete, this method will delete the resources from the Hibernate Search index.List<ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId> everything(String theResourceName, SearchParameterMap theParams, ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId theReferencingPid, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails) extractLuceneIndexData(org.hl7.fhir.instance.model.api.IBaseResource theResource, ResourceTable theEntity, ResourceIndexedSearchParams theNewParams) List<org.hl7.fhir.instance.model.api.IBaseResource> getResources(Collection<Long> thePids) Returns inlined resource stored along with index mappings for matched identifiersbooleanList<ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId> lastN(SearchParameterMap theParams, Integer theMaximumResults) voidreindex(ResourceTable theEntity) Re-publish the resource to the full-text indexList<ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId> search(String theResourceName, SearchParameterMap theParams, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails) Search the Lucene/Elastic index for pids using params supported in theParams, consuming entries from theParams when used to query.List<org.hl7.fhir.instance.model.api.IBaseResource> searchForResources(String theResourceType, SearchParameterMap theParams, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails) searchNotScrolled(String theResourceName, SearchParameterMap theParams, Integer theMaxResultsToFetch, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails) Query the index for a plain list (non-scrollable) iterator of results.searchScrolled(String theResourceType, SearchParameterMap theParams, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails) Query the index for a complete iterator of ALL results.booleansupportsAllOf(SearchParameterMap theParams) booleansupportsAllSortTerms(String theResourceType, SearchParameterMap theParams) Given a resource type and aSearchParameterMap, return true only if all sort terms are supported.org.hl7.fhir.instance.model.api.IBaseResourceAutocomplete search for NIH $expand contextDirection=existing
-
Constructor Details
-
FulltextSearchSvcImpl
public FulltextSearchSvcImpl()Constructor
-
-
Method Details
-
extractLuceneIndexData
public ExtendedHSearchIndexData extractLuceneIndexData(org.hl7.fhir.instance.model.api.IBaseResource theResource, ResourceTable theEntity, ResourceIndexedSearchParams theNewParams) - Specified by:
extractLuceneIndexDatain interfaceIFulltextSearchSvc
-
canUseHibernateSearch
Description copied from interface:IFulltextSearchSvcReturns true if the parameter map can be handled for hibernate search. We have to filter out any queries that might use search params we only know how to handle in JPA. - SeeExtendedHSearchSearchBuilder.addAndConsumeAdvancedQueryClauses(ca.uhn.fhir.jpa.dao.search.ExtendedHSearchClauseBuilder, ca.uhn.fhir.jpa.model.search.ExtendedHSearchBuilderConsumeAdvancedQueryClausesParams)- Specified by:
canUseHibernateSearchin interfaceIFulltextSearchSvc
-
reindex
Description copied from interface:IFulltextSearchSvcRe-publish the resource to the full-text index. - During update, hibernate search only republishes the entity if it has changed. During $reindex, we want to force the re-index.- Specified by:
reindexin interfaceIFulltextSearchSvc- Parameters:
theEntity- the fully populated ResourceTable entity
-
searchNotScrolled
public ISearchQueryExecutor searchNotScrolled(String theResourceName, SearchParameterMap theParams, Integer theMaxResultsToFetch, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails) Description copied from interface:IFulltextSearchSvcQuery the index for a plain list (non-scrollable) iterator of results.- Specified by:
searchNotScrolledin interfaceIFulltextSearchSvc- Parameters:
theResourceName- e.g. PatienttheParams- The search querytheMaxResultsToFetch- maximum results to fetchtheRequestDetails- The request details- Returns:
- Iterator of result PIDs
-
searchScrolled
@Transactional public ISearchQueryExecutor searchScrolled(String theResourceType, SearchParameterMap theParams, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails) Description copied from interface:IFulltextSearchSvcQuery the index for a complete iterator of ALL results. (scrollable search result).- Specified by:
searchScrolledin interfaceIFulltextSearchSvc- Parameters:
theResourceType- e.g. PatienttheParams- The search querytheRequestDetails- The request details- Returns:
- Iterator of result PIDs
-
everything
public List<ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId> everything(String theResourceName, SearchParameterMap theParams, ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId theReferencingPid, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails) - Specified by:
everythingin interfaceIFulltextSearchSvc
-
isDisabled
- Specified by:
isDisabledin interfaceIFulltextSearchSvc
-
search
@Transactional public List<ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId> search(String theResourceName, SearchParameterMap theParams, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails) Description copied from interface:IFulltextSearchSvcSearch the Lucene/Elastic index for pids using params supported in theParams, consuming entries from theParams when used to query.- Specified by:
searchin interfaceIFulltextSearchSvc- Parameters:
theResourceName- the resource name to restrict the query.theParams- the full query - modified to return only params unused by the index.theRequestDetails- The request details- Returns:
- the pid list for the matchign resources.
-
tokenAutocompleteValueSetSearch
@Transactional public org.hl7.fhir.instance.model.api.IBaseResource tokenAutocompleteValueSetSearch(ValueSetAutocompleteOptions theOptions) Description copied from interface:IFulltextSearchSvcAutocomplete search for NIH $expand contextDirection=existing- Specified by:
tokenAutocompleteValueSetSearchin interfaceIFulltextSearchSvc- Parameters:
theOptions- operation options- Returns:
- a ValueSet with the search hits as the expansion.
-
lastN
public List<ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId> lastN(SearchParameterMap theParams, Integer theMaximumResults) - Specified by:
lastNin interfaceIFulltextSearchSvc
-
getResources
Description copied from interface:IFulltextSearchSvcReturns inlined resource stored along with index mappings for matched identifiers- Specified by:
getResourcesin interfaceIFulltextSearchSvc- Parameters:
thePids- raw pids - we dont support versioned references- Returns:
- Resources list or empty if nothing found
-
count
Description copied from interface:IFulltextSearchSvcReturns accurate hit count- Specified by:
countin interfaceIFulltextSearchSvc
-
searchForResources
@Transactional(readOnly=true) public List<org.hl7.fhir.instance.model.api.IBaseResource> searchForResources(String theResourceType, SearchParameterMap theParams, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails) - Specified by:
searchForResourcesin interfaceIFulltextSearchSvc
-
supportsAllOf
- Specified by:
supportsAllOfin interfaceIFulltextSearchSvc
-
supportsAllSortTerms
Description copied from interface:IFulltextSearchSvcGiven a resource type and aSearchParameterMap, return true only if all sort terms are supported.- Specified by:
supportsAllSortTermsin interfaceIFulltextSearchSvc- Parameters:
theResourceType- The resource type for the query.theParams- TheSearchParameterMapbeing searched with.- Returns:
- true if all sort terms are supported, false otherwise.
-
deleteIndexedDocumentsByTypeAndId
Description copied from interface:IFulltextSearchSvcGiven a resource type that is indexed by hibernate search, and a list of objects reprenting the IDs you wish to delete, this method will delete the resources from the Hibernate Search index. This is useful for situations where a deletion occurred outside a Hibernate ORM session, leaving dangling documents in the index.- Specified by:
deleteIndexedDocumentsByTypeAndIdin interfaceIFulltextSearchSvc- Parameters:
theClazz- The class, which must be annotated withIndexedtheGivenIds- The list of IDs for the given document type. Note that while this is a List
-