Class HibernateOrmSearchSession
- All Implemented Interfaces:
BackendSessionContext,AutomaticIndexingEventSendingSessionContext,HibernateOrmLoadingSessionContext,HibernateOrmMassIndexingSessionContext,HibernateOrmScopeSessionContext,SearchScopeProvider,HibernateOrmSessionContext,SearchSession,BatchSessionContext,SearchIndexingPlanSessionContext,PojoImplicitReindexingResolverSessionContext,BridgeSessionContext,PojoLoadingSessionContext,PojoMassIndexingSessionContext,PojoIndexingProcessorSessionContext,PojoScopeSessionContext,PojoWorkSessionContext
SearchSession.-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidautomaticIndexingSynchronizationStrategy(AutomaticIndexingSynchronizationStrategy synchronizationStrategy) Set theAutomaticIndexingSynchronizationStrategyto use for this session.voidcurrentIndexingPlan(boolean createIfDoesNotExist) static HibernateOrmSearchSessionget(HibernateOrmSearchSessionMappingContext context, SessionImplementor sessionImplementor) static HibernateOrmSearchSessionget(HibernateOrmSearchSessionMappingContext context, SessionImplementor sessionImplementor, boolean createIfDoesNotExist) voidSet a filter configuration and define which types must be included/excluded when indexed within indexing plans of the current session (either automatically or manually).voidindexingPlanSynchronizationStrategy(IndexingPlanSynchronizationStrategy synchronizationStrategy) Set theIndexingPlanSynchronizationStrategyto use for this session.massIndexer(Collection<? extends Class<?>> classes) Creates aMassIndexerto rebuild the indexes mapped to indexed entity types among the given classes and their subtypes.schemaManager(Collection<? extends Class<?>> classes) Create aSearchSchemaManagerfor the indexes mapped to indexed entity types among the given classes and their subtypes.<T> SearchScope<T>scope(Class<T> expectedSuperType, Collection<String> entityNames) Creates aSearchScopelimited to indexed entity types among the entities with the given names and their subtypes.<T> SearchScopeImpl<T>scope(Collection<? extends Class<? extends T>> classes) Creates aSearchScopelimited to indexed entity types among the given classes and their subtypes.<T> SearchQuerySelectStep<?,EntityReference, T, SearchLoadingOptionsStep, ?, ?> search(Collection<? extends Class<? extends T>> classes) Initiate the building of a search query.<T> SearchQuerySelectStep<?,EntityReference, T, SearchLoadingOptionsStep, ?, ?> search(SearchScopeImpl<T> scope) <T> SearchQuerySelectStep<?,EntityReference, T, SearchLoadingOptionsStep, ?, ?> search(SearchScope<T> scope) Initiate the building of a search query.session()workspace(Collection<? extends Class<?>> classes) Create aSearchWorkspacefor the indexes mapped to indexed entity types among the given classes and their subtypes.Methods inherited from class org.hibernate.search.mapper.pojo.session.spi.AbstractPojoSearchSession
identifierBridgeFromDocumentIdentifierContext, propertyBridgeWriteContext, routingBridgeRouteContext, typeBridgeWriteContext, valueBridgeFromIndexedValueContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hibernate.search.mapper.pojo.bridge.runtime.spi.BridgeSessionContext
identifierBridgeFromDocumentIdentifierContext, propertyBridgeWriteContext, routingBridgeRouteContext, typeBridgeWriteContext, valueBridgeFromIndexedValueContextMethods inherited from interface org.hibernate.search.mapper.orm.scope.SearchScopeProvider
scope, scopeMethods inherited from interface org.hibernate.search.mapper.orm.session.SearchSession
massIndexer, massIndexer, schemaManager, schemaManager, search, workspace, workspace
-
Method Details
-
get
public static HibernateOrmSearchSession get(HibernateOrmSearchSessionMappingContext context, SessionImplementor sessionImplementor) - Parameters:
sessionImplementor- A Hibernate session- Returns:
- The
HibernateOrmSearchSessionto use within the context of the given session.
-
get
public static HibernateOrmSearchSession get(HibernateOrmSearchSessionMappingContext context, SessionImplementor sessionImplementor, boolean createIfDoesNotExist) - Parameters:
sessionImplementor- A Hibernate session- Returns:
- The
HibernateOrmSearchSessionto use within the context of the given session.
-
mappingContext
- Specified by:
mappingContextin interfaceBackendSessionContext- Specified by:
mappingContextin interfaceBridgeSessionContext- Specified by:
mappingContextin interfacePojoScopeSessionContext- Specified by:
mappingContextin interfacePojoWorkSessionContext- Overrides:
mappingContextin classAbstractPojoSearchSession
-
tenantIdentifier
- Specified by:
tenantIdentifierin interfaceBackendSessionContext- Specified by:
tenantIdentifierin interfaceBridgeSessionContext- Specified by:
tenantIdentifierin interfacePojoMassIndexingSessionContext
-
tenantIdentifierValue
- Specified by:
tenantIdentifierValuein interfaceBridgeSessionContext
-
createIndexer
- Specified by:
createIndexerin interfaceBatchSessionContext- Specified by:
createIndexerin interfacePojoMassIndexingSessionContext- Overrides:
createIndexerin classAbstractPojoSearchSession
-
search
public <T> SearchQuerySelectStep<?,EntityReference, searchT, SearchLoadingOptionsStep, ?, ?> (Collection<? extends Class<? extends T>> classes) Description copied from interface:SearchSessionInitiate the building of a search query.The query will target the indexes mapped to indexed entity types among the given classes and their subtypes.
- Specified by:
searchin interfaceSearchSession- Type Parameters:
T- A supertype of all indexed types that will be targeted by the search query.- Parameters:
classes- A collection of classes. Each must be an indexed entity type or a supertype of such type.- Returns:
- The initial step of a DSL where the search query can be defined.
- See Also:
-
search
public <T> SearchQuerySelectStep<?,EntityReference, searchT, SearchLoadingOptionsStep, ?, ?> (SearchScope<T> scope) Description copied from interface:SearchSessionInitiate the building of a search query.The query will target the indexes in the given scope.
- Specified by:
searchin interfaceSearchSession- Type Parameters:
T- A supertype of all types in the given scope.- Parameters:
scope- A scope representing all indexed types that will be targeted by the search query.- Returns:
- The initial step of a DSL where the search query can be defined.
- See Also:
-
search
public <T> SearchQuerySelectStep<?,EntityReference, searchT, SearchLoadingOptionsStep, ?, ?> (SearchScopeImpl<T> scope) -
schemaManager
Description copied from interface:SearchSessionCreate aSearchSchemaManagerfor the indexes mapped to indexed entity types among the given classes and their subtypes.- Specified by:
schemaManagerin interfaceSearchSession- Parameters:
classes- A collection of classes. Each must be an indexed entity type or a supertype of such type.- Returns:
- A
SearchSchemaManager.
-
workspace
Description copied from interface:SearchSessionCreate aSearchWorkspacefor the indexes mapped to indexed entity types among the given classes and their subtypes.- Specified by:
workspacein interfaceSearchSession- Parameters:
classes- A collection of classes. Each must be an indexed entity type or a supertype of such type.- Returns:
- A
SearchWorkspace.
-
massIndexer
Description copied from interface:SearchSessionCreates aMassIndexerto rebuild the indexes mapped to indexed entity types among the given classes and their subtypes.- Specified by:
massIndexerin interfaceSearchSession- Parameters:
classes- A collection of classes. Each must be an indexed entity type or a supertype of such type.- Returns:
- The created mass indexer.
-
scope
Description copied from interface:SearchScopeProviderCreates aSearchScopelimited to indexed entity types among the given classes and their subtypes.- Specified by:
scopein interfaceSearchScopeProvider- Type Parameters:
T- A supertype of all indexed entity types to include in the scope.- Parameters:
classes- A collection of classes. Each must be an indexed entity type or a supertype of such type.- Returns:
- The created scope.
- See Also:
-
scope
Description copied from interface:SearchScopeProviderCreates aSearchScopelimited to indexed entity types among the entities with the given names and their subtypes.- Specified by:
scopein interfaceSearchScopeProvider- Type Parameters:
T- A supertype of all indexed entity types to include in the scope.- Parameters:
expectedSuperType- A supertype of all indexed entity types to include in the scope.entityNames- A collection of entity names. SeeEntity.name(). Each entity type referenced in the collection must be an indexed entity type or a supertype of such type.- Returns:
- The created scope.
- See Also:
-
toEntityManager
- Specified by:
toEntityManagerin interfaceSearchSession- Returns:
- The underlying
EntityManagerused by thisSearchSession.
-
toOrmSession
- Specified by:
toOrmSessionin interfaceSearchSession- Returns:
- The underlying
Sessionused by thisSearchSession.
-
indexingPlan
- Specified by:
indexingPlanin interfaceSearchSession- Returns:
- The indexing plan for this session, allowing to explicitly index entities or delete them from the index, or to process entity changes or even write to the indexes before the transaction is committed.
-
automaticIndexingSynchronizationStrategy
public void automaticIndexingSynchronizationStrategy(AutomaticIndexingSynchronizationStrategy synchronizationStrategy) Description copied from interface:SearchSessionSet theAutomaticIndexingSynchronizationStrategyto use for this session.Behavior is undefined if called while entity changes are pending: be sure to call this only just after creating a session, or just after committing a transaction.
- Specified by:
automaticIndexingSynchronizationStrategyin interfaceSearchSession- Parameters:
synchronizationStrategy- The synchronization strategy to use- See Also:
-
indexingPlanSynchronizationStrategy
public void indexingPlanSynchronizationStrategy(IndexingPlanSynchronizationStrategy synchronizationStrategy) Description copied from interface:SearchSessionSet theIndexingPlanSynchronizationStrategyto use for this session.Behavior is undefined if called while entity changes are pending: be sure to call this only just after creating a session, or just after committing a transaction.
- Specified by:
indexingPlanSynchronizationStrategyin interfaceSearchSession- Parameters:
synchronizationStrategy- The synchronization strategy to use- See Also:
-
indexingPlanFilter
Description copied from interface:SearchSessionSet a filter configuration and define which types must be included/excluded when indexed within indexing plans of the current session (either automatically or manually).This does not affect indexing that does not rely on indexing plans, like the mass indexer.
If a type is not explicitly included/excluded directly or through an included/excluded supertype, the decision will be made by
an application filter, which defaults to including all types.- Specified by:
indexingPlanFilterin interfaceSearchSession- Parameters:
filter- The filter that includes/excludes types when indexed.
-
configuredIndexingPlanFilter
- Specified by:
configuredIndexingPlanFilterin interfacePojoWorkSessionContext
-
session
- Specified by:
sessionin interfaceAutomaticIndexingEventSendingSessionContext- Specified by:
sessionin interfaceHibernateOrmLoadingSessionContext- Specified by:
sessionin interfaceHibernateOrmMassIndexingSessionContext- Specified by:
sessionin interfaceHibernateOrmSessionContext- Returns:
- The Hibernate ORM
Session.
-
entityReferenceFactory
- Specified by:
entityReferenceFactoryin interfaceAutomaticIndexingEventSendingSessionContext
-
defaultLoadingContext
- Specified by:
defaultLoadingContextin interfacePojoWorkSessionContext
-
runtimeIntrospector
- Specified by:
runtimeIntrospectorin interfacePojoImplicitReindexingResolverSessionContext- Specified by:
runtimeIntrospectorin interfacePojoIndexingProcessorSessionContext- Specified by:
runtimeIntrospectorin interfacePojoLoadingSessionContext- Specified by:
runtimeIntrospectorin interfacePojoMassIndexingSessionContext- Specified by:
runtimeIntrospectorin interfaceSearchIndexingPlanSessionContext
-
currentIndexingPlan
- Specified by:
currentIndexingPlanin interfaceSearchIndexingPlanSessionContext
-
createIndexingQueueEventProcessingPlan
-
checkOpen
public void checkOpen()- Specified by:
checkOpenin interfaceSearchIndexingPlanSessionContext
-
configuredAutomaticIndexingSynchronizationStrategy
public ConfiguredIndexingPlanSynchronizationStrategy configuredAutomaticIndexingSynchronizationStrategy()- Specified by:
configuredAutomaticIndexingSynchronizationStrategyin interfaceSearchIndexingPlanSessionContext
-