Interface SearchMapping
-
public interface SearchMappingThe Hibernate Search mapping between the Hibernate ORM model and the backend(s).Provides entry points to Hibernate Search operations that are not tied to a specific ORM session.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Collection<? extends SearchIndexedEntity<?>>allIndexedEntities()Backendbackend()Backendbackend(String backendName)<E> SearchIndexedEntity<E>indexedEntity(Class<E> entityType)SearchIndexedEntity<?>indexedEntity(String entityName)IndexManagerindexManager(String indexName)default <T> SearchScope<T>scope(Class<T> type)Create aSearchScopelimited to the given type.default <T> SearchScope<T>scope(Class<T> expectedSuperType, String entityName)Create aSearchScopelimited to entity types referenced by their name.<T> SearchScope<T>scope(Class<T> expectedSuperType, Collection<String> entityNames)Create aSearchScopelimited to entity types referenced by their name.<T> SearchScope<T>scope(Collection<? extends Class<? extends T>> types)Create aSearchScopelimited to the given types.javax.persistence.EntityManagerFactorytoEntityManagerFactory()SessionFactorytoOrmSessionFactory()
-
-
-
Method Detail
-
scope
default <T> SearchScope<T> scope(Class<T> type)
Create aSearchScopelimited 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 aSearchScopelimited 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 aSearchScopelimited 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 aSearchScopelimited 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
-
toEntityManagerFactory
javax.persistence.EntityManagerFactory toEntityManagerFactory()
- Returns:
- The underlying
EntityManagerFactoryused by thisSearchMapping.
-
toOrmSessionFactory
SessionFactory toOrmSessionFactory()
- Returns:
- The underlying
SessionFactoryused by thisSearchMapping.
-
indexedEntity
<E> SearchIndexedEntity<E> indexedEntity(Class<E> entityType)
- Type Parameters:
E- The type of an indexed entity.- Parameters:
entityType- The type of an indexed entity. This must be the exact type; passing the type of a mapped-superclass for example will not work.- Returns:
- A
SearchIndexedEntityfor the indexed entity with the exact given type. - Throws:
SearchException- If the type does not match any indexed entity.
-
indexedEntity
SearchIndexedEntity<?> indexedEntity(String entityName)
- Parameters:
entityName- The name of an indexed entity. SeeEntity.name().- Returns:
- A
SearchIndexedEntityfor the indexed entity with the given name. - Throws:
SearchException- If the name does not match any indexed entity.
-
allIndexedEntities
Collection<? extends SearchIndexedEntity<?>> allIndexedEntities()
- Returns:
- A collection containing one
SearchIndexedEntityfor each indexed entity
-
indexManager
IndexManager indexManager(String indexName)
- Parameters:
indexName- The name of an index. SeeIndexed.index().- Returns:
- The index manager for the index having
indexNameas name.
-
backend
Backend backend()
- Returns:
- The default backend, if any.
-
backend
Backend backend(String backendName)
- Parameters:
backendName- The name of a backend. SeeIndexed.backend().- Returns:
- The backend having
backendNameas name.
-
-