Package org.hibernate.search.impl
Class ImmutableSearchFactory
java.lang.Object
org.hibernate.search.impl.ImmutableSearchFactory
- All Implemented Interfaces:
SearchFactoryImplementor,SearchFactory,BuildContext,SearchFactoryImplementorWithShareableState,SearchFactoryState,SearchFactoryIntegrator,WorkerBuildContext
public class ImmutableSearchFactory
extends Object
implements SearchFactoryImplementorWithShareableState, WorkerBuildContext
This implementation is never directly exposed to the user, it is always wrapped into a
MutableSearchFactory-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddClasses(Class<?>... classes) Add the following classes to the SearchFactoryvoidclose()Return an Hibernate Search query object.getAnalyzer(Class<?> clazz) Retrieves the scoped analyzer for a given class.getAnalyzer(String name) Retrieve an analyzer instance by its definition nameintgetClassesInDirectoryProvider(DirectoryProvider<?> directoryProvider) getDirectoryProviderData(DirectoryProvider<?> provider) This method cannot be used in initialize methods.Set<DirectoryProvider<?>> getDirectoryProviders(Class<?> entity) Provide access to the DirectoryProviders for a given entity.getDocumentBuilderContainedEntity(Class<T> entityType) <T> DocumentBuilderIndexedEntity<T> getDocumentBuilderIndexedEntity(Class<T> entityType) Map<Class<?>, DocumentBuilderIndexedEntity<?>> intgetFilterDefinition(String name) getIndexedTypesPolymorphic(Class<?>[] classes) getIndexingParameters(DirectoryProvider<?> provider) getOptimizerStrategy(DirectoryProvider<?> provider) getSimilarity(DirectoryProvider<?> provider) Retrieve the statistics instance for this factory.Retrieve the statistics implementor instance for this factory.Returns the SessionFactoryImplementor instance.booleanbooleanbooleanmakeBatchBackend(MassIndexerProgressMonitor progressMonitor, Integer forceToNumWriterThreads) voidoptimize()Optimize all indexesvoidOptimize the index holdingentityTypevoidreleaseService(Class<? extends ServiceProvider<?>> provider) Release a service from duty.<T> TrequestService(Class<? extends ServiceProvider<T>> provider) Declare the use of a service.voidsetBackendQueueProcessorFactory(BackendQueueProcessorFactory backendQueueProcessorFactory) Register the backend queue processor factory.
-
Constructor Details
-
ImmutableSearchFactory
-
-
Method Details
-
getBackendQueueProcessorFactory
- Specified by:
getBackendQueueProcessorFactoryin interfaceSearchFactoryImplementor- Specified by:
getBackendQueueProcessorFactoryin interfaceSearchFactoryState
-
getFilterDefinitions
- Specified by:
getFilterDefinitionsin interfaceSearchFactoryState
-
getIndexingStrategy
- Specified by:
getIndexingStrategyin interfaceBuildContext- Specified by:
getIndexingStrategyin interfaceSearchFactoryImplementor- Specified by:
getIndexingStrategyin interfaceSearchFactoryState
-
close
public void close()- Specified by:
closein interfaceSearchFactoryIntegrator
-
createHSQuery
Description copied from interface:SearchFactoryIntegratorReturn an Hibernate Search query object. This object uses fluent APIs to define the query executed. Offers a few execution approaches: - return the list of results eagerly - return the list of results lazily - get the number of results- Specified by:
createHSQueryin interfaceSearchFactoryIntegrator
-
getClassesInDirectoryProvider
- Specified by:
getClassesInDirectoryProviderin interfaceSearchFactoryImplementor- Specified by:
getClassesInDirectoryProviderin interfaceWorkerBuildContext
-
getDocumentBuildersContainedEntities
- Specified by:
getDocumentBuildersContainedEntitiesin interfaceSearchFactoryState
-
getDirectoryProviderData
- Specified by:
getDirectoryProviderDatain interfaceSearchFactoryState
-
getDocumentBuildersIndexedEntities
- Specified by:
getDocumentBuildersIndexedEntitiesin interfaceSearchFactoryImplementor- Specified by:
getDocumentBuildersIndexedEntitiesin interfaceSearchFactoryState
-
getDocumentBuilderIndexedEntity
- Specified by:
getDocumentBuilderIndexedEntityin interfaceSearchFactoryImplementor- Specified by:
getDocumentBuilderIndexedEntityin interfaceWorkerBuildContext
-
getDocumentBuilderContainedEntity
- Specified by:
getDocumentBuilderContainedEntityin interfaceSearchFactoryImplementor
-
getDirectoryProviders
- Specified by:
getDirectoryProvidersin interfaceBuildContext- Specified by:
getDirectoryProvidersin interfaceSearchFactoryImplementor
-
addClasses
Description copied from interface:SearchFactoryIntegratorAdd the following classes to the SearchFactory- Specified by:
addClassesin interfaceSearchFactoryIntegrator
-
getWorker
- Specified by:
getWorkerin interfaceSearchFactoryIntegrator- Specified by:
getWorkerin interfaceSearchFactoryState
-
setBackendQueueProcessorFactory
public void setBackendQueueProcessorFactory(BackendQueueProcessorFactory backendQueueProcessorFactory) Description copied from interface:WorkerBuildContextRegister the backend queue processor factory. Should only be called by the Worker implementation. TODO should we move it to a different interface- Specified by:
setBackendQueueProcessorFactoryin interfaceSearchFactoryState- Specified by:
setBackendQueueProcessorFactoryin interfaceWorkerBuildContext
-
getOptimizerStrategy
- Specified by:
getOptimizerStrategyin interfaceSearchFactoryImplementor- Specified by:
getOptimizerStrategyin interfaceWorkerBuildContext
-
getIndexingParameters
- Specified by:
getIndexingParametersin interfaceSearchFactoryImplementor- Specified by:
getIndexingParametersin interfaceWorkerBuildContext
-
getReaderProvider
- Specified by:
getReaderProviderin interfaceSearchFactory- Specified by:
getReaderProviderin interfaceSearchFactoryState- Returns:
- Return the configured reader provider.
-
getDirectoryProviders
Description copied from interface:SearchFactoryProvide 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.- Specified by:
getDirectoryProvidersin interfaceSearchFactory- Parameters:
entity- the entity for which to return the directory providers- Returns:
- array of
DirectoryProviders for the specified entity
-
optimize
public void optimize()Description copied from interface:SearchFactoryOptimize all indexes- Specified by:
optimizein interfaceSearchFactory
-
optimize
Description copied from interface:SearchFactoryOptimize the index holdingentityType- Specified by:
optimizein interfaceSearchFactory- Parameters:
entityType- the entity type (index) to optimize
-
getAnalyzer
Description copied from interface:SearchFactoryRetrieve an analyzer instance by its definition name- Specified by:
getAnalyzerin interfaceSearchFactory- Parameters:
name- the name of the analyzer- Returns:
- analyzer with the specified name
-
getAnalyzer
Description copied from interface:SearchFactoryRetrieves the scoped analyzer for a given class.- Specified by:
getAnalyzerin interfaceSearchFactory- Parameters:
clazz- The class for which to retrieve the analyzer.- Returns:
- The scoped analyzer for the specified class.
-
buildQueryBuilder
- Specified by:
buildQueryBuilderin interfaceSearchFactory- Returns:
- return a query builder providing a fluent API to create Lucene queries
-
getStatistics
Description copied from interface:SearchFactoryRetrieve the statistics instance for this factory.- Specified by:
getStatisticsin interfaceSearchFactory- Returns:
- The statistics.
-
getStatisticsImplementor
Description copied from interface:SearchFactoryImplementorRetrieve the statistics implementor instance for this factory.- Specified by:
getStatisticsImplementorin interfaceSearchFactoryImplementor- Returns:
- The statistics implementor.
-
getFilterCachingStrategy
- Specified by:
getFilterCachingStrategyin interfaceSearchFactoryImplementor- Specified by:
getFilterCachingStrategyin interfaceSearchFactoryState
-
getAnalyzers
- Specified by:
getAnalyzersin interfaceSearchFactoryState
-
getCacheBitResultsSize
public int getCacheBitResultsSize()- Specified by:
getCacheBitResultsSizein interfaceSearchFactoryState
-
getConfigurationProperties
- Specified by:
getConfigurationPropertiesin interfaceSearchFactoryState
-
getFilterDefinition
- Specified by:
getFilterDefinitionin interfaceSearchFactoryImplementor
-
getDirectoryProviderLock
Description copied from interface:BuildContextThis method cannot be used in initialize methods. start methods can use it though.- Specified by:
getDirectoryProviderLockin interfaceBuildContext- Specified by:
getDirectoryProviderLockin interfaceSearchFactoryImplementor- Parameters:
dp-- Returns:
-
requestService
Description copied from interface:BuildContextDeclare the use of a service. All callers of this method must call (@link #releaseService} or the service will not be released- Specified by:
requestServicein interfaceBuildContext- Type Parameters:
T- class of the service- Parameters:
provider- of the service- Returns:
- the service instance
-
releaseService
Description copied from interface:BuildContextRelease a service from duty. Each call to (@link #requestService} should be coupled with a call to (@link #releaseService} when the service is no longer needed.- Specified by:
releaseServicein interfaceBuildContext- Parameters:
provider- of the service
-
getFilterCacheBitResultsSize
public int getFilterCacheBitResultsSize()- Specified by:
getFilterCacheBitResultsSizein interfaceSearchFactoryImplementor
-
getIndexedTypesPolymorphic
- Specified by:
getIndexedTypesPolymorphicin interfaceSearchFactoryImplementor
-
makeBatchBackend
public BatchBackend makeBatchBackend(MassIndexerProgressMonitor progressMonitor, Integer forceToNumWriterThreads) - Specified by:
makeBatchBackendin interfaceSearchFactoryImplementor
-
getSimilarity
- Specified by:
getSimilarityin interfaceSearchFactoryImplementor- Specified by:
getSimilarityin interfaceWorkerBuildContext
-
getDirectoryProviderData
- Specified by:
getDirectoryProviderDatain interfaceWorkerBuildContext
-
getErrorHandler
- Specified by:
getErrorHandlerin interfaceSearchFactoryImplementor- Specified by:
getErrorHandlerin interfaceSearchFactoryState- Specified by:
getErrorHandlerin interfaceWorkerBuildContext
-
getIndexHierarchy
- Specified by:
getIndexHierarchyin interfaceSearchFactoryState
-
getDirectoryProviderIndexingParams
- Specified by:
getDirectoryProviderIndexingParamsin interfaceSearchFactoryState
-
getServiceManager
- Specified by:
getServiceManagerin interfaceSearchFactoryState
-
getUninitializedSearchFactory
Description copied from interface:BuildContextReturns the SessionFactoryImplementor instance. Do not use until after the initialize and/or start method is fully executed. Implementations should not cache values provided by the SessionFactoryImplementor but rather access them each time: when the configuration is dynamically updated, new changes are available through the SearchFactoryImplementor For example, prefervoid method() { int size = sfi.getDirectoryProviders().size(); }tovoid method() { int size = directoryProviders.size(); }where directoryProviders is a class variable.- Specified by:
getUninitializedSearchFactoryin interfaceBuildContext
-
isJMXEnabled
public boolean isJMXEnabled()- Specified by:
isJMXEnabledin interfaceSearchFactoryImplementor
-
isDirtyChecksEnabled
public boolean isDirtyChecksEnabled()- Specified by:
isDirtyChecksEnabledin interfaceSearchFactoryImplementor- Returns:
- true if we are allowed to inspect entity state to potentially skip some indexing operations. Can be disabled to get pre-3.4 behavior (always rebuild document)
-
isStopped
public boolean isStopped()- Specified by:
isStoppedin interfaceSearchFactoryIntegrator- Returns:
- true if the SearchFactory was stopped
-