Interface SearchSession
-
public interface SearchSession
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
automaticIndexingSynchronizationStrategy(AutomaticIndexingSynchronizationStrategy synchronizationStrategy)
Set theAutomaticIndexingSynchronizationStrategy
to use for this session.SearchIndexingPlan
indexingPlan()
default MassIndexer
massIndexer()
Creates aMassIndexer
to rebuild the indexes of all indexed entity types.default MassIndexer
massIndexer(Class<?>... types)
Creates aMassIndexer
to rebuild the indexes mapped to the given types, or to any of their sub-types.MassIndexer
massIndexer(Collection<? extends Class<?>> types)
Creates aMassIndexer
to rebuild the indexes mapped to the given types, or to any of their sub-types.default SearchSchemaManager
schemaManager()
Create aSearchSchemaManager
for all indexes.default SearchSchemaManager
schemaManager(Class<?>... types)
Create aSearchSchemaManager
for the indexes mapped to the given type, or to any of its sub-types.SearchSchemaManager
schemaManager(Collection<? extends Class<?>> types)
Create aSearchSchemaManager
for the indexes mapped to the given types, or to any of their sub-types.default <T> SearchScope<T>
scope(Class<T> type)
Create aSearchScope
limited to the given type.default <T> SearchScope<T>
scope(Class<T> expectedSuperType, String entityName)
Create aSearchScope
limited to entity types referenced by their name.<T> SearchScope<T>
scope(Class<T> expectedSuperType, Collection<String> entityNames)
Create aSearchScope
limited to entity types referenced by their name.<T> SearchScope<T>
scope(Collection<? extends Class<? extends T>> types)
Create aSearchScope
limited to the given types.default <T> SearchQuerySelectStep<?,EntityReference,T,SearchLoadingOptionsStep,?,?>
search(Class<T> type)
Initiate the building of a search query.<T> SearchQuerySelectStep<?,EntityReference,T,SearchLoadingOptionsStep,?,?>
search(Collection<? extends Class<? extends T>> types)
Initiate the building of a search query.<T> SearchQuerySelectStep<?,EntityReference,T,SearchLoadingOptionsStep,?,?>
search(SearchScope<T> scope)
Initiate the building of a search query.javax.persistence.EntityManager
toEntityManager()
org.hibernate.Session
toOrmSession()
default SearchWorkspace
workspace()
Create aSearchWorkspace
for the indexes mapped to all indexed types.default SearchWorkspace
workspace(Class<?>... types)
Create aSearchWorkspace
for the indexes mapped to the given type, or to any of its sub-types.SearchWorkspace
workspace(Collection<? extends Class<?>> types)
Create aSearchWorkspace
for the indexes mapped to the given types, or to any of their sub-types.
-
-
-
Method Detail
-
search
default <T> SearchQuerySelectStep<?,EntityReference,T,SearchLoadingOptionsStep,?,?> search(Class<T> type)
Initiate the building of a search query.The query will target the indexes mapped to the given type, or to any of its sub-types.
- Type Parameters:
T
- An indexed type, or a supertype of all indexed types that will be targeted by the search query.- Parameters:
type
- An indexed type, or a supertype 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
<T> SearchQuerySelectStep<?,EntityReference,T,SearchLoadingOptionsStep,?,?> search(Collection<? extends Class<? extends T>> types)
Initiate the building of a search query.The query will target the indexes mapped to the given types, or to any of their sub-types.
- 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
<T> SearchQuerySelectStep<?,EntityReference,T,SearchLoadingOptionsStep,?,?> search(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:
SearchQuerySelectStep
-
schemaManager
default SearchSchemaManager schemaManager()
Create aSearchSchemaManager
for all indexes.- Returns:
- A
SearchSchemaManager
.
-
schemaManager
default SearchSchemaManager schemaManager(Class<?>... types)
Create aSearchSchemaManager
for the indexes mapped to the given type, or to any of its sub-types.- Parameters:
types
- One or more indexed types, or supertypes of all indexed types that will be targeted by the schema manager.- Returns:
- A
SearchSchemaManager
.
-
schemaManager
SearchSchemaManager schemaManager(Collection<? extends Class<?>> types)
Create aSearchSchemaManager
for the indexes mapped to the given types, or to any of their sub-types.- 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
default SearchWorkspace workspace()
Create aSearchWorkspace
for the indexes mapped to all indexed types.- Returns:
- A
SearchWorkspace
.
-
workspace
default SearchWorkspace workspace(Class<?>... types)
Create aSearchWorkspace
for the indexes mapped to the given type, or to any of its sub-types.- Parameters:
types
- One or more indexed types, or supertypes of all indexed types that will be targeted by the workspace.- Returns:
- A
SearchWorkspace
.
-
workspace
SearchWorkspace workspace(Collection<? extends Class<?>> types)
Create aSearchWorkspace
for the indexes mapped to the given types, or to any of their sub-types.- Parameters:
types
- A collection of indexed types, or supertypes of all indexed types that will be targeted by the workspace.- Returns:
- A
SearchWorkspace
.
-
massIndexer
default MassIndexer massIndexer()
Creates aMassIndexer
to rebuild the indexes of all indexed entity types.MassIndexer
instances cannot be reused.- Returns:
- The created mass indexer.
-
massIndexer
default MassIndexer massIndexer(Class<?>... types)
Creates aMassIndexer
to rebuild the indexes mapped to the given types, or to any of their sub-types.MassIndexer
instances cannot be reused.- Parameters:
types
- An array of indexed types, or supertypes of all indexed types that will be targeted by the workspace.- Returns:
- The created mass indexer.
-
massIndexer
MassIndexer massIndexer(Collection<? extends Class<?>> types)
Creates aMassIndexer
to rebuild the indexes mapped to the given types, or to any of their sub-types.- Parameters:
types
- A collection of indexed types, or supertypes of all indexed types that will be targeted by the workspace.- Returns:
- A
SearchWorkspace
.
-
scope
default <T> SearchScope<T> scope(Class<T> type)
Create aSearchScope
limited to the given type.- Type Parameters:
T
- A type to include in the scope.- Parameters:
type
- A type to include in the scope.- Returns:
- The created scope.
- See Also:
SearchScope
-
scope
<T> SearchScope<T> scope(Collection<? extends Class<? extends T>> types)
Create aSearchScope
limited to the given types.- 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
default <T> SearchScope<T> scope(Class<T> expectedSuperType, String entityName)
Create aSearchScope
limited to entity types referenced by their name.- 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.entityName
- An entity name. SeeEntity.name()
.- Returns:
- The created scope.
- See Also:
SearchScope
-
scope
<T> SearchScope<T> scope(Class<T> expectedSuperType, Collection<String> entityNames)
Create aSearchScope
limited to entity types referenced by their name.- 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
-
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
javax.persistence.EntityManager toEntityManager()
- Returns:
- The underlying
EntityManager
used by thisSearchSession
.
-
toOrmSession
org.hibernate.Session toOrmSession()
- Returns:
- The underlying
Session
used by thisSearchSession
.
-
automaticIndexingSynchronizationStrategy
void automaticIndexingSynchronizationStrategy(AutomaticIndexingSynchronizationStrategy synchronizationStrategy)
Set theAutomaticIndexingSynchronizationStrategy
to 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:
AutomaticIndexingSynchronizationStrategy
-
-