
Package ca.uhn.fhir.jpa.search.builder
Class SearchBuilder
java.lang.Object
ca.uhn.fhir.jpa.search.builder.SearchBuilder
- All Implemented Interfaces:
- ISearchBuilder<JpaPid>
The SearchBuilder is responsible for actually forming the SQL query that handles
 searches for resources
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final JpaPid[]static final intDeprecated.protected jakarta.persistence.EntityManagerprotected final ca.uhn.fhir.interceptor.api.IInterceptorBroadcasterstatic Integerprotected final IResourceTagDaostatic final Stringstatic final Stringstatic final StringFields inherited from interface ca.uhn.fhir.jpa.dao.ISearchBuilderSEARCH_BUILDER_BEAN_NAME
- 
Constructor SummaryConstructorsConstructorDescriptionSearchBuilder(String theResourceName, JpaStorageSettings theStorageSettings, ca.uhn.fhir.jpa.config.HapiFhirLocalContainerEntityManagerFactoryBean theEntityManagerFactory, SqlObjectFactory theSqlBuilderFactory, HibernatePropertiesProvider theDialectProvider, ca.uhn.fhir.rest.server.util.ISearchParamRegistry theSearchParamRegistry, PartitionSettings thePartitionSettings, ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster theInterceptorBroadcaster, IResourceTagDao theResourceTagDao, DaoRegistry theDaoRegistry, ca.uhn.fhir.context.FhirContext theContext, IIdHelperService theIdHelperService, IResourceHistoryTableDao theResourceHistoryTagDao, IJpaStorageResourceParser theIJpaStorageResourceParser, Class<? extends org.hl7.fhir.instance.model.api.IBaseResource> theResourceType) Constructor
- 
Method SummaryModifier and TypeMethodDescriptioncreateCountQuery(SearchParameterMap theParams, String theSearchUuid, ca.uhn.fhir.rest.api.server.RequestDetails theRequest, RequestPartitionId theRequestPartitionId) createQuery(SearchParameterMap theParams, SearchRuntimeDetails theSearchRuntimeDetails, ca.uhn.fhir.rest.api.server.RequestDetails theRequest, RequestPartitionId theRequestPartitionId) static Optional<ResourceHistoryTable> findLatestVersion(ca.uhn.fhir.rest.api.server.RequestDetails theRequest, JpaPid nextWantedPid, IResourceHistoryTableDao resourceHistoryTableDao, ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster interceptorBroadcaster1) jakarta.persistence.criteria.CriteriaBuilderstatic intClass<? extends org.hl7.fhir.instance.model.api.IBaseResource> loadIncludes(ca.uhn.fhir.context.FhirContext theContext, jakarta.persistence.EntityManager theEntityManager, Collection<JpaPid> theMatches, Collection<ca.uhn.fhir.model.api.Include> theIncludes, boolean theReverseMode, ca.uhn.fhir.rest.param.DateRangeParam theLastUpdated, String theSearchIdOrDescription, ca.uhn.fhir.rest.api.server.RequestDetails theRequest, Integer theMaxCount) THIS SHOULD RETURN HASHSET and not just Set because we add to it later so it can't be Collections.emptySet() or some such thing.loadIncludes(SearchBuilderLoadIncludesParameters<JpaPid> theParameters) voidloadResourcesByPid(Collection<JpaPid> thePids, Collection<JpaPid> theIncludedPids, List<org.hl7.fhir.instance.model.api.IBaseResource> theResourceListToPopulate, boolean theForHistoryOperation, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails) booleanvoidsetDeduplicateInDatabase(boolean theShouldDeduplicateInDB) voidsetFetchSize(int theFetchSize) voidsetFullTextSearch(IFulltextSearchSvc theFulltextSearchSvc) static voidsetMaxPageSizeForTest(Integer theTestSize) voidsetMaxResultsToFetch(Integer theMaxResultsToFetch) voidsetPreviouslyAddedResourcePids(List<JpaPid> thePidSet) voidsetRequireTotal(boolean theRequireTotal) Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ca.uhn.fhir.jpa.dao.ISearchBuildercreateQueryStream, loadResourcesByPid
- 
Field Details- 
MAXIMUM_PAGE_SIZEDeprecated.See loadResourcesByPid for an explanation of why we use the constant 800- See Also:
 
- 
RESOURCE_ID_ALIAS- See Also:
 
- 
PARTITION_ID_ALIAS- See Also:
 
- 
RESOURCE_VERSION_ALIAS- See Also:
 
- 
EMPTY_JPA_PID_ARRAY
- 
myMaxPageSizeForTests
- 
myInterceptorBroadcaster
- 
myResourceTagDao
- 
myEntityManager
 
- 
- 
Constructor Details- 
SearchBuilderpublic SearchBuilder(String theResourceName, JpaStorageSettings theStorageSettings, ca.uhn.fhir.jpa.config.HapiFhirLocalContainerEntityManagerFactoryBean theEntityManagerFactory, SqlObjectFactory theSqlBuilderFactory, HibernatePropertiesProvider theDialectProvider, ca.uhn.fhir.rest.server.util.ISearchParamRegistry theSearchParamRegistry, PartitionSettings thePartitionSettings, ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster theInterceptorBroadcaster, IResourceTagDao theResourceTagDao, DaoRegistry theDaoRegistry, ca.uhn.fhir.context.FhirContext theContext, IIdHelperService theIdHelperService, IResourceHistoryTableDao theResourceHistoryTagDao, IJpaStorageResourceParser theIJpaStorageResourceParser, Class<? extends org.hl7.fhir.instance.model.api.IBaseResource> theResourceType) Constructor
 
- 
- 
Method Details- 
setFullTextSearch
- 
setMaxResultsToFetch- Specified by:
- setMaxResultsToFetchin interface- ISearchBuilder<JpaPid>
 
- 
setDeduplicateInDatabase- Specified by:
- setDeduplicateInDatabasein interface- ISearchBuilder<JpaPid>
 
- 
setRequireTotal- Specified by:
- setRequireTotalin interface- ISearchBuilder<JpaPid>
 
- 
requiresTotal- Specified by:
- requiresTotalin interface- ISearchBuilder<JpaPid>
 
- 
createCountQuerypublic Long createCountQuery(SearchParameterMap theParams, String theSearchUuid, ca.uhn.fhir.rest.api.server.RequestDetails theRequest, @Nonnull RequestPartitionId theRequestPartitionId) - Specified by:
- createCountQueryin interface- ISearchBuilder<JpaPid>
 
- 
setPreviouslyAddedResourcePids- Specified by:
- setPreviouslyAddedResourcePidsin interface- ISearchBuilder<JpaPid>
- Parameters:
- thePidSet- May be null
 
- 
createQuerypublic IResultIterator<JpaPid> createQuery(SearchParameterMap theParams, SearchRuntimeDetails theSearchRuntimeDetails, ca.uhn.fhir.rest.api.server.RequestDetails theRequest, @Nonnull RequestPartitionId theRequestPartitionId) - Specified by:
- createQueryin interface- ISearchBuilder<JpaPid>
 
- 
findLatestVersion@Nonnull public static Optional<ResourceHistoryTable> findLatestVersion(ca.uhn.fhir.rest.api.server.RequestDetails theRequest, JpaPid nextWantedPid, IResourceHistoryTableDao resourceHistoryTableDao, ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster interceptorBroadcaster1) 
- 
loadResourcesByPidpublic void loadResourcesByPid(Collection<JpaPid> thePids, Collection<JpaPid> theIncludedPids, List<org.hl7.fhir.instance.model.api.IBaseResource> theResourceListToPopulate, boolean theForHistoryOperation, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails) - Specified by:
- loadResourcesByPidin interface- ISearchBuilder<JpaPid>
 
- 
loadIncludespublic Set<JpaPid> loadIncludes(ca.uhn.fhir.context.FhirContext theContext, jakarta.persistence.EntityManager theEntityManager, Collection<JpaPid> theMatches, Collection<ca.uhn.fhir.model.api.Include> theIncludes, boolean theReverseMode, ca.uhn.fhir.rest.param.DateRangeParam theLastUpdated, String theSearchIdOrDescription, ca.uhn.fhir.rest.api.server.RequestDetails theRequest, Integer theMaxCount) THIS SHOULD RETURN HASHSET and not just Set because we add to it later so it can't be Collections.emptySet() or some such thing. The JpaPid returned will have resource type populated.- Specified by:
- loadIncludesin interface- ISearchBuilder<JpaPid>
 
- 
loadIncludes- Specified by:
- loadIncludesin interface- ISearchBuilder<JpaPid>
 
- 
setFetchSize- Specified by:
- setFetchSizein interface- ISearchBuilder<JpaPid>
 
- 
getParams
- 
getBuilder
- 
getResourceType
- 
getResourceName
- 
getMaximumPageSize
- 
setMaxPageSizeForTest
 
-