Package org.hibernate.search
Interface SearchFactory
- All Known Subinterfaces:
SearchFactoryImplementor,SearchFactoryImplementorWithShareableState,SearchFactoryIntegrator
- All Known Implementing Classes:
ImmutableSearchFactory,MutableSearchFactory
public interface SearchFactory
Provide application wide operations as well as access to the underlying Lucene resources.
-
Method Summary
Modifier and TypeMethodDescriptiongetAnalyzer(Class<?> clazz) Retrieves the scoped analyzer for a given class.getAnalyzer(String name) Retrieve an analyzer instance by its definition namegetDirectoryProviders(Class<?> entity) Provide access to the DirectoryProviders for a given entity.Retrieve the statistics instance for this factory.voidoptimize()Optimize all indexesvoidOptimize the index holdingentityType
-
Method Details
-
getReaderProvider
ReaderProvider getReaderProvider()- Returns:
- Return the configured reader provider.
-
getDirectoryProviders
Provide access to the DirectoryProviders for a given entity. In most cases, the returned type will be a one element array. But if the given entity is configured to use sharded indexes, then multiple elements will be returned. In this case all of them should be considered.- Parameters:
entity- the entity for which to return the directory providers- Returns:
- array of
DirectoryProviders for the specified entity
-
optimize
void optimize()Optimize all indexes -
optimize
Optimize the index holdingentityType- Parameters:
entityType- the entity type (index) to optimize
-
getAnalyzer
Retrieve an analyzer instance by its definition name- Parameters:
name- the name of the analyzer- Returns:
- analyzer with the specified name
- Throws:
SearchException- if the definition name is unknown
-
getAnalyzer
Retrieves the scoped analyzer for a given class.- Parameters:
clazz- The class for which to retrieve the analyzer.- Returns:
- The scoped analyzer for the specified class.
- Throws:
IllegalArgumentException- in caseclazz == nullor the specified class is not an indexed entity.
-
buildQueryBuilder
QueryContextBuilder buildQueryBuilder()- Returns:
- return a query builder providing a fluent API to create Lucene queries
-
getStatistics
Statistics getStatistics()Retrieve the statistics instance for this factory.- Returns:
- The statistics.
-