Interface SearchSession
- All Superinterfaces:
SearchScopeProvider
Session/EntityManager.
Provides entry points to Hibernate Search operations that involve indexing and searching, and that make use of the ORM session.
-
Method Summary
Modifier and TypeMethodDescriptionvoidautomaticIndexingSynchronizationStrategy(AutomaticIndexingSynchronizationStrategy synchronizationStrategy) Deprecated.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.default MassIndexerCreates aMassIndexerto rebuild the indexes of all indexed entity types.default MassIndexermassIndexer(Class<?>... classes) Creates aMassIndexerto rebuild the indexes mapped to indexed entity types among the given classes and their subtypes.massIndexer(Collection<? extends Class<?>> classes) Creates aMassIndexerto rebuild the indexes mapped to indexed entity types among the given classes and their subtypes.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, SearchLoadingOptionsStep, ?, ?> Initiate the building of a search query.search(Collection<? extends Class<? extends T>> classes) Initiate the building of a search query.<SR,T> SearchQuerySelectStep <SR, ?, EntityReference, T, SearchLoadingOptionsStep, ?, ?> search(HibernateOrmRootReferenceScope<SR, T> scope) Initiate the building of a search query.<T> SearchQuerySelectStep<?, ?, EntityReference, T, SearchLoadingOptionsStep, ?, ?> search(SearchScope<T> scope) Initiate the building of a search query.<SR,T> SearchQuerySelectStep <SR, ?, EntityReference, T, SearchLoadingOptionsStep, ?, ?> search(TypedSearchScope<SR, T> scope) Initiate the building of a search query.jakarta.persistence.EntityManagerdefault 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.orm.scope.SearchScopeProvider
scope, scope, scope, scope, typedScope, typedScope
-
Method Details
-
search
default <T> SearchQuerySelectStep<NonStaticMetamodelScope,?, searchEntityReference, T, SearchLoadingOptionsStep, ?, ?> (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, SearchLoadingOptionsStep, ?, ?> (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
<SR,T> SearchQuerySelectStep<SR,?, searchEntityReference, T, SearchLoadingOptionsStep, ?, ?> (TypedSearchScope<SR, T> scope) 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
<T> SearchQuerySelectStep<?,?, searchEntityReference, T, SearchLoadingOptionsStep, ?, ?> (SearchScope<T> scope) 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
@Incubating <SR,T> SearchQuerySelectStep<SR,?, searchEntityReference, T, SearchLoadingOptionsStep, ?, ?> (HibernateOrmRootReferenceScope<SR, T> scope) 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:
-
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.
-
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 mapped to indexed entity types 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 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:
- The created mass indexer.
-
indexingPlan
SearchIndexingPlan indexingPlan()- 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.
-
toEntityManager
jakarta.persistence.EntityManager toEntityManager()- Returns:
- The underlying
EntityManagerused by thisSearchSession.
-
toOrmSession
Session toOrmSession()- Returns:
- The underlying
Sessionused by thisSearchSession.
-
automaticIndexingSynchronizationStrategy
@Deprecated(since="6.2") void automaticIndexingSynchronizationStrategy(AutomaticIndexingSynchronizationStrategy synchronizationStrategy) Deprecated.Set 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.
- Parameters:
synchronizationStrategy- The synchronization strategy to use- See Also:
-
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, or just after committing a transaction.
- Parameters:
synchronizationStrategy- The synchronization strategy to use- See Also:
-
indexingPlanFilter
Set 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.- Parameters:
filter- The filter that includes/excludes types when indexed.
-
indexingPlanSynchronizationStrategy(IndexingPlanSynchronizationStrategy)instead.