Interface SearchSession
- All Superinterfaces:
AutoCloseable,SearchScopeProvider
A Hibernate Search session, bound to a particular tenant identifier (if any),
and with its own overridden settings regarding commits, refresh, etc.
Provides entry points to Hibernate Search operations that involve indexing and searching.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Execute any pending work in theindexing planand release any resource held by this session.indexer()voidindexingPlanSynchronizationStrategy(IndexingPlanSynchronizationStrategy synchronizationStrategy) Set theIndexingPlanSynchronizationStrategyto use for this session.booleanisOpen()Determine whether the search session is open.default MassIndexerCreates aMassIndexerto rebuild the indexes of all indexed entity types.default MassIndexermassIndexer(Class<?>... classes) Creates aMassIndexerto rebuild the indexes of indexed entity classes among the given classes and their subtypes.massIndexer(Collection<? extends Class<?>> classes) Creates aMassIndexerto rebuild the indexes mapped to the given types, or to any of their sub-types.default SearchSchemaManagerCreate aSearchSchemaManagerfor all indexes.default SearchSchemaManagerschemaManager(Class<?>... classes) Create aSearchSchemaManagerfor 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.default <T> SearchQuerySelectStep<NonStaticMetamodelScope, ?, EntityReference, T, ?, ?, ?> Initiate the building of a search query.<T> SearchQuerySelectStep<NonStaticMetamodelScope, ?, EntityReference, T, ?, ?, ?> search(Collection<? extends Class<? extends T>> classes) Initiate the building of a search query.<T> SearchQuerySelectStep<?, ?, EntityReference, T, ?, ?, ?> search(SearchScope<T> scope) Initiate the building of a search query.<SR,T> SearchQuerySelectStep <SR, ?, EntityReference, T, ?, ?, ?> search(StandalonePojoRootReferenceScope<SR, T> scope) Initiate the building of a search query.<SR,T> SearchQuerySelectStep <SR, ?, EntityReference, T, ?, ?, ?> search(TypedSearchScope<SR, T> scope) Initiate the building of a search query.Deprecated, for removal: This API element is subject to removal in a future version.default SearchWorkspaceCreate aSearchWorkspacefor the indexes mapped to all indexed types.default SearchWorkspaceCreate aSearchWorkspacefor the indexes mapped to indexed entity types among the given classes and their subtypes.workspace(Collection<? extends Class<?>> classes) Create aSearchWorkspacefor the indexes mapped to indexed entity types among the given classes and their subtypes.Methods inherited from interface org.hibernate.search.mapper.pojo.standalone.scope.SearchScopeProvider
scope, scope, scope, scope, typedScope, typedScope
-
Method Details
-
close
void close()Execute any pending work in theindexing planand release any resource held by this session.- Specified by:
closein interfaceAutoCloseable
-
isOpen
boolean isOpen()Determine whether the search session is open.- Returns:
- true until the search session has been closed
-
massIndexer
Creates aMassIndexerto rebuild the indexes of all indexed entity types.MassIndexerinstances cannot be reused.- Returns:
- The created mass indexer.
-
massIndexer
Creates aMassIndexerto rebuild the indexes of indexed entity classes among the given classes and their subtypes.MassIndexerinstances cannot be reused.- Parameters:
classes- An array of classes. Each must be an indexed entity type or a supertype of such type.- Returns:
- The created mass indexer.
-
massIndexer
Creates aMassIndexerto rebuild the indexes mapped to the given types, or to any of their sub-types.- Parameters:
classes- A collection of classes. Each must be an indexed entity type or a supertype of such type.- Returns:
- A
MassIndexer.
-
search
default <T> SearchQuerySelectStep<NonStaticMetamodelScope,?, searchEntityReference, T, ?, ?, ?> (Class<T> clazz) Initiate the building of a search query.The query will target the indexes mapped to indexed entity types among the given class and its subtypes.
- Type Parameters:
T- An indexed type, or a supertype of all indexed types that will be targeted by the search query.- Parameters:
clazz- A class that 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
<T> SearchQuerySelectStep<NonStaticMetamodelScope,?, searchEntityReference, T, ?, ?, ?> (Collection<? extends Class<? extends T>> classes) Initiate the building of a search query.The query will target the indexes mapped to indexed entity types among the given classes and their subtypes.
- 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
Initiate the building of a search query.The query will target the indexes in the given scope.
- 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
Initiate the building of a search query.The query will target the indexes in the given scope.
- Type Parameters:
SR- Scope root type.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
@Incubating <SR,T> SearchQuerySelectStep<SR,?, searchEntityReference, T, ?, ?, ?> (StandalonePojoRootReferenceScope<SR, T> scope) Initiate the building of a search query.The query will target the indexes in the given scope.
- Type Parameters:
SR- Scope root type.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:
-
schemaManager
Create aSearchSchemaManagerfor all indexes.- Returns:
- A
SearchSchemaManager.
-
schemaManager
Create aSearchSchemaManagerfor the indexes mapped to indexed entity types among the given classes and their subtypes.- Parameters:
classes- An array of classes. Each must be an indexed entity type or a supertype of such type.- Returns:
- A
SearchSchemaManager.
-
schemaManager
Create aSearchSchemaManagerfor the indexes mapped to indexed entity types among the given classes and their subtypes.- Parameters:
classes- A collection of classes. Each must be an indexed entity type or a supertype of such type.- Returns:
- A
SearchSchemaManager.
-
workspace
Create aSearchWorkspacefor the indexes mapped to all indexed types.- Returns:
- A
SearchWorkspace.
-
workspace
Create aSearchWorkspacefor the indexes mapped to indexed entity types among the given classes and their subtypes.- Parameters:
classes- An array of classes. Each must be an indexed entity type or a supertype of such type.- Returns:
- A
SearchWorkspace.
-
workspace
Create aSearchWorkspacefor the indexes mapped to indexed entity types among the given classes and their subtypes.- Parameters:
classes- A collection of classes. Each must be an indexed entity type or a supertype of such type.- Returns:
- A
SearchWorkspace.
-
indexingPlan
SearchIndexingPlan indexingPlan()- Returns:
- The indexing plan for this session. It will be executed upon closing this session.
-
indexer
SearchIndexer indexer()- Returns:
- The indexer for this session.
-
tenantIdentifier
Deprecated, for removal: This API element is subject to removal in a future version.UsetenantIdentifierValue()instead.- Returns:
- The tenant identifier for this session.
-
tenantIdentifierValue
Object tenantIdentifierValue()- Returns:
- The tenant identifier for this session.
-
indexingPlanSynchronizationStrategy
void indexingPlanSynchronizationStrategy(IndexingPlanSynchronizationStrategy synchronizationStrategy) Set 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.
- Parameters:
synchronizationStrategy- The synchronization strategy to use- See Also:
-
tenantIdentifierValue()instead.