Class HibernateOrmSearchSession
- java.lang.Object
-
- org.hibernate.search.mapper.pojo.session.spi.AbstractPojoSearchSession
-
- org.hibernate.search.mapper.orm.session.impl.HibernateOrmSearchSession
-
- All Implemented Interfaces:
BackendSessionContext,AutomaticIndexingEventSendingSessionContext,LoadingSessionContext,HibernateOrmMassIndexingSessionContext,HibernateOrmScopeSessionContext,HibernateOrmSessionContext,SearchSession,BatchSessionContext,SearchIndexingPlanSessionContext,PojoImplicitReindexingResolverSessionContext,BridgeSessionContext,PojoMassIndexingSessionContext,PojoIndexingProcessorSessionContext,PojoScopeSessionContext,PojoWorkSessionContext
public class HibernateOrmSearchSession extends AbstractPojoSearchSession implements SearchSession, HibernateOrmSessionContext, HibernateOrmScopeSessionContext, SearchIndexingPlanSessionContext, AutomaticIndexingEventSendingSessionContext
The actual implementation ofSearchSession.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHibernateOrmSearchSession.Builder
-
Method Summary
-
Methods inherited from class org.hibernate.search.mapper.pojo.session.spi.AbstractPojoSearchSession
identifierBridgeFromDocumentIdentifierContext, propertyBridgeWriteContext, routingBridgeRouteContext, typeBridgeWriteContext, valueBridgeFromIndexedValueContext
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.search.mapper.pojo.bridge.runtime.spi.BridgeSessionContext
identifierBridgeFromDocumentIdentifierContext, propertyBridgeWriteContext, routingBridgeRouteContext, typeBridgeWriteContext, valueBridgeFromIndexedValueContext
-
Methods inherited from interface org.hibernate.search.mapper.orm.session.SearchSession
massIndexer, massIndexer, schemaManager, schemaManager, scope, scope, search, workspace, workspace
-
-
-
-
Method Detail
-
get
public static HibernateOrmSearchSession get(HibernateOrmSearchSessionMappingContext context, org.hibernate.engine.spi.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, org.hibernate.engine.spi.SessionImplementor sessionImplementor, boolean createIfDoesNotExist)
- Parameters:
sessionImplementor- A Hibernate session- Returns:
- The
HibernateOrmSearchSessionto use within the context of the given session.
-
mappingContext
public HibernateOrmSearchSessionMappingContext mappingContext()
- Specified by:
mappingContextin interfaceBackendSessionContext- Specified by:
mappingContextin interfaceBridgeSessionContext- Specified by:
mappingContextin interfacePojoScopeSessionContext- Specified by:
mappingContextin interfacePojoWorkSessionContext- Overrides:
mappingContextin classAbstractPojoSearchSession
-
tenantIdentifier
public String tenantIdentifier()
- Specified by:
tenantIdentifierin interfaceBackendSessionContext- Specified by:
tenantIdentifierin interfaceBridgeSessionContext- Specified by:
tenantIdentifierin interfacePojoMassIndexingSessionContext
-
createIndexer
public PojoIndexer createIndexer()
- Specified by:
createIndexerin interfaceBatchSessionContext- Specified by:
createIndexerin interfacePojoMassIndexingSessionContext- Overrides:
createIndexerin classAbstractPojoSearchSession
-
search
public <T> SearchQuerySelectStep<?,EntityReference,T,SearchLoadingOptionsStep,?,?> search(Collection<? extends Class<? extends T>> types)
Description copied from interface:SearchSessionInitiate the building of a search query.The query will target the indexes mapped to the given types, or to any of their sub-types.
- Specified by:
searchin interfaceSearchSession- Type Parameters:
T- A supertype of all indexed types that will be targeted by the search query.- Parameters:
types- A collection of indexed types, or supertypes of 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:
SearchQuerySelectStep
-
search
public <T> SearchQuerySelectStep<?,EntityReference,T,SearchLoadingOptionsStep,?,?> search(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:
SearchQuerySelectStep
-
search
public <T> SearchQuerySelectStep<?,EntityReference,T,SearchLoadingOptionsStep,?,?> search(SearchScopeImpl<T> scope)
-
schemaManager
public SearchSchemaManager schemaManager(Collection<? extends Class<?>> types)
Description copied from interface:SearchSessionCreate aSearchSchemaManagerfor the indexes mapped to the given types, or to any of their sub-types.- Specified by:
schemaManagerin interfaceSearchSession- Parameters:
types- A collection of indexed types, or supertypes of all indexed types that will be targeted by the schema manager.- Returns:
- A
SearchSchemaManager.
-
workspace
public SearchWorkspace workspace(Collection<? extends Class<?>> types)
Description copied from interface:SearchSessionCreate aSearchWorkspacefor the indexes mapped to the given types, or to any of their sub-types.- Specified by:
workspacein interfaceSearchSession- Parameters:
types- A collection of indexed types, or supertypes of all indexed types that will be targeted by the workspace.- Returns:
- A
SearchWorkspace.
-
massIndexer
public MassIndexer massIndexer(Collection<? extends Class<?>> types)
Description copied from interface:SearchSessionCreates aMassIndexerto rebuild the indexes mapped to the given types, or to any of their sub-types.- Specified by:
massIndexerin interfaceSearchSession- Parameters:
types- A collection of indexed types, or supertypes of all indexed types that will be targeted by the workspace.- Returns:
- A
SearchWorkspace.
-
scope
public <T> SearchScopeImpl<T> scope(Collection<? extends Class<? extends T>> types)
Description copied from interface:SearchSessionCreate aSearchScopelimited to the given types.- Specified by:
scopein interfaceSearchSession- Type Parameters:
T- A supertype of all types to include in the scope.- Parameters:
types- A collection of types to include in the scope.- Returns:
- The created scope.
- See Also:
SearchScope
-
scope
public <T> SearchScope<T> scope(Class<T> expectedSuperType, Collection<String> entityNames)
Description copied from interface:SearchSessionCreate aSearchScopelimited to entity types referenced by their name.- Specified by:
scopein interfaceSearchSession- Type Parameters:
T- A supertype of all entity types to include in the scope.- Parameters:
expectedSuperType- A supertype of all entity types to include in the scope.entityNames- A collection of entity names. SeeEntity.name().- Returns:
- The created scope.
- See Also:
SearchScope
-
toEntityManager
public EntityManager toEntityManager()
- Specified by:
toEntityManagerin interfaceSearchSession- Returns:
- The underlying
EntityManagerused by thisSearchSession.
-
toOrmSession
public org.hibernate.Session toOrmSession()
- Specified by:
toOrmSessionin interfaceSearchSession- Returns:
- The underlying
Sessionused by thisSearchSession.
-
indexingPlan
public SearchIndexingPlan 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:
AutomaticIndexingSynchronizationStrategy
-
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:
IndexingPlanSynchronizationStrategy
-
indexingPlanFilter
public void indexingPlanFilter(SearchIndexingPlanFilter filter)
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
public ConfiguredSearchIndexingPlanFilter configuredIndexingPlanFilter()
- Specified by:
configuredIndexingPlanFilterin interfacePojoWorkSessionContext
-
session
public org.hibernate.engine.spi.SessionImplementor session()
- Specified by:
sessionin interfaceAutomaticIndexingEventSendingSessionContext- Specified by:
sessionin interfaceHibernateOrmMassIndexingSessionContext- Specified by:
sessionin interfaceHibernateOrmSessionContext- Specified by:
sessionin interfaceLoadingSessionContext- Returns:
- The Hibernate ORM
Session.
-
entityReferenceFactory
public EntityReferenceFactory entityReferenceFactory()
- Specified by:
entityReferenceFactoryin interfaceAutomaticIndexingEventSendingSessionContext
-
defaultLoadingContext
public PojoSelectionLoadingContext defaultLoadingContext()
- Specified by:
defaultLoadingContextin interfacePojoWorkSessionContext
-
runtimeIntrospector
public PojoRuntimeIntrospector runtimeIntrospector()
- Specified by:
runtimeIntrospectorin interfaceLoadingSessionContext- Specified by:
runtimeIntrospectorin interfacePojoImplicitReindexingResolverSessionContext- Specified by:
runtimeIntrospectorin interfacePojoIndexingProcessorSessionContext- Specified by:
runtimeIntrospectorin interfacePojoMassIndexingSessionContext- Specified by:
runtimeIntrospectorin interfaceSearchIndexingPlanSessionContext
-
currentIndexingPlan
public PojoIndexingPlan currentIndexingPlan(boolean createIfDoesNotExist)
- Specified by:
currentIndexingPlanin interfaceSearchIndexingPlanSessionContext
-
createIndexingQueueEventProcessingPlan
public PojoIndexingQueueEventProcessingPlan createIndexingQueueEventProcessingPlan()
-
checkOpen
public void checkOpen()
- Specified by:
checkOpenin interfaceSearchIndexingPlanSessionContext
-
configuredAutomaticIndexingSynchronizationStrategy
public ConfiguredIndexingPlanSynchronizationStrategy configuredAutomaticIndexingSynchronizationStrategy()
- Specified by:
configuredAutomaticIndexingSynchronizationStrategyin interfaceSearchIndexingPlanSessionContext
-
-