public class ImmutableSearchFactory extends Object implements SearchFactoryImplementorWithShareableState, WorkerBuildContext
MutableSearchFactory
Constructor and Description |
---|
ImmutableSearchFactory(SearchFactoryState state) |
Modifier and Type | Method and Description |
---|---|
void |
addClasses(Class<?>... classes)
Add the following classes to the SearchFactory.
|
QueryContextBuilder |
buildQueryBuilder() |
void |
close() |
HSQuery |
createHSQuery()
Return an Hibernate Search query object.
|
IndexManagerHolder |
getAllIndexesManager() |
org.apache.lucene.analysis.Analyzer |
getAnalyzer(Class<?> clazz)
Retrieves the scoped analyzer for a given class.
|
org.apache.lucene.analysis.Analyzer |
getAnalyzer(String name)
Retrieve an analyzer instance by its definition name
|
Map<String,org.apache.lucene.analysis.Analyzer> |
getAnalyzers() |
int |
getCacheBitResultsSize() |
Properties |
getConfigurationProperties() |
TimeoutExceptionFactory |
getDefaultTimeoutExceptionFactory() |
<T> DocumentBuilderContainedEntity<T> |
getDocumentBuilderContainedEntity(Class<T> entityType) |
Map<Class<?>,DocumentBuilderContainedEntity<?>> |
getDocumentBuildersContainedEntities() |
ErrorHandler |
getErrorHandler()
Used to catch exceptions in all synchronous operations; but default they are logged, the user
can configure alternative error management means.
|
int |
getFilterCacheBitResultsSize() |
FilterCachingStrategy |
getFilterCachingStrategy() |
FilterDef |
getFilterDefinition(String name) |
Map<String,FilterDef> |
getFilterDefinitions() |
EntityIndexBinding |
getIndexBinding(Class<?> entityType)
Returns the entity to index binding for the given type.
|
Map<Class<?>,EntityIndexBinder> |
getIndexBindingForEntity() |
EntityIndexBinder |
getIndexBindingForEntity(Class<?> entityType) |
Map<Class<?>,EntityIndexBinding> |
getIndexBindings()
Returns a map of all known entity index binding (indexed entities) keyed against the indexed type
|
IndexedTypeDescriptor |
getIndexedTypeDescriptor(Class<?> entityType)
Returns a descriptor for the specified entity type describing its indexed state.
|
Set<Class<?>> |
getIndexedTypes()
Returns the set of currently indexed types.
|
Set<Class<?>> |
getIndexedTypesPolymorphic(Class<?>[] classes) |
PolymorphicIndexHierarchy |
getIndexHierarchy() |
String |
getIndexingStrategy()
Returns the configured indexing strategy (event vs manual).
|
IndexManagerFactory |
getIndexManagerFactory() |
IndexManagerHolder |
getIndexManagerHolder() |
IndexReaderAccessor |
getIndexReaderAccessor()
Provides access to the IndexReader API
|
InstanceInitializer |
getInstanceInitializer() |
SearchMapping |
getProgrammaticMapping() |
EntityIndexBinding |
getSafeIndexBindingForEntity(Class<?> entityType) |
ServiceManager |
getServiceManager()
Access the
ServiceManager . |
Statistics |
getStatistics()
Retrieve the statistics instance for this factory.
|
StatisticsImplementor |
getStatisticsImplementor()
Retrieve the statistics implementor instance for this factory.
|
TimingSource |
getTimingSource() |
SearchFactoryImplementor |
getUninitializedSearchFactory()
Returns the
SessionFactoryImplementor instance. |
Worker |
getWorker() |
boolean |
isDirtyChecksEnabled() |
boolean |
isIdProvidedImplicit() |
boolean |
isIndexMetadataComplete() |
boolean |
isJMXEnabled() |
boolean |
isStopped() |
boolean |
isTransactionManagerExpected() |
BatchBackend |
makeBatchBackend(MassIndexerProgressMonitor progressMonitor) |
void |
optimize()
Optimize all indexes
|
void |
optimize(Class entityType)
Optimize the index holding
entityType |
void |
releaseService(Class<? extends ServiceProvider<?>> provider)
Release a service from duty.
|
<T> T |
requestService(Class<? extends ServiceProvider<T>> provider)
Declare the use of a service.
|
public ImmutableSearchFactory(SearchFactoryState state)
public Map<String,FilterDef> getFilterDefinitions()
getFilterDefinitions
in interface SearchFactoryState
public String getIndexingStrategy()
BuildContext
getIndexingStrategy
in interface SearchFactoryImplementor
getIndexingStrategy
in interface BuildContext
getIndexingStrategy
in interface SearchFactoryState
Environment.INDEXING_STRATEGY
public void close()
close
in interface SearchFactoryIntegrator
public HSQuery createHSQuery()
SearchFactoryIntegrator
createHSQuery
in interface SearchFactoryIntegrator
public Map<Class<?>,DocumentBuilderContainedEntity<?>> getDocumentBuildersContainedEntities()
getDocumentBuildersContainedEntities
in interface SearchFactoryState
public Map<Class<?>,EntityIndexBinding> getIndexBindings()
SearchFactoryImplementor
getIndexBindings
in interface SearchFactoryImplementor
getIndexBindings
in interface SearchFactoryState
public Map<Class<?>,EntityIndexBinder> getIndexBindingForEntity()
getIndexBindingForEntity
in interface SearchFactoryImplementor
getIndexBindingForEntity
in interface SearchFactoryState
public EntityIndexBinder getIndexBindingForEntity(Class<?> entityType)
getIndexBindingForEntity
in interface SearchFactoryIntegrator
public EntityIndexBinding getIndexBinding(Class<?> entityType)
SearchFactoryIntegrator
getIndexBinding
in interface SearchFactoryIntegrator
entityType
- the type for which to retrieve the bindingnull
is returned for types which are unindexed or
unknown.public <T> DocumentBuilderContainedEntity<T> getDocumentBuilderContainedEntity(Class<T> entityType)
getDocumentBuilderContainedEntity
in interface SearchFactoryImplementor
public void addClasses(Class<?>... classes)
SearchFactoryIntegrator
addClasses
in interface SearchFactoryIntegrator
public Worker getWorker()
getWorker
in interface SearchFactoryState
getWorker
in interface SearchFactoryIntegrator
public void optimize()
SearchFactory
optimize
in interface SearchFactory
public void optimize(Class entityType)
SearchFactory
entityType
optimize
in interface SearchFactory
entityType
- the entity type (index) to optimizepublic org.apache.lucene.analysis.Analyzer getAnalyzer(String name)
SearchFactory
getAnalyzer
in interface SearchFactory
name
- the name of the analyzerpublic org.apache.lucene.analysis.Analyzer getAnalyzer(Class<?> clazz)
SearchFactory
getAnalyzer
in interface SearchFactory
clazz
- The class for which to retrieve the analyzer.public QueryContextBuilder buildQueryBuilder()
buildQueryBuilder
in interface SearchFactory
public Statistics getStatistics()
SearchFactory
getStatistics
in interface SearchFactory
public StatisticsImplementor getStatisticsImplementor()
SearchFactoryImplementor
getStatisticsImplementor
in interface SearchFactoryImplementor
public FilterCachingStrategy getFilterCachingStrategy()
getFilterCachingStrategy
in interface SearchFactoryImplementor
getFilterCachingStrategy
in interface SearchFactoryState
public Map<String,org.apache.lucene.analysis.Analyzer> getAnalyzers()
getAnalyzers
in interface SearchFactoryState
public int getCacheBitResultsSize()
getCacheBitResultsSize
in interface SearchFactoryState
public Properties getConfigurationProperties()
getConfigurationProperties
in interface SearchFactoryState
public FilterDef getFilterDefinition(String name)
getFilterDefinition
in interface SearchFactoryImplementor
public <T> T requestService(Class<? extends ServiceProvider<T>> provider)
BuildContext
requestService
in interface BuildContext
T
- class of the serviceprovider
- of the servicepublic void releaseService(Class<? extends ServiceProvider<?>> provider)
BuildContext
releaseService
in interface BuildContext
provider
- of the servicepublic int getFilterCacheBitResultsSize()
getFilterCacheBitResultsSize
in interface SearchFactoryImplementor
public Set<Class<?>> getIndexedTypesPolymorphic(Class<?>[] classes)
getIndexedTypesPolymorphic
in interface SearchFactoryImplementor
public BatchBackend makeBatchBackend(MassIndexerProgressMonitor progressMonitor)
makeBatchBackend
in interface SearchFactoryImplementor
public PolymorphicIndexHierarchy getIndexHierarchy()
getIndexHierarchy
in interface SearchFactoryState
public ServiceManager getServiceManager()
BuildContext
ServiceManager
.
Clients should keep a reference to the ServiceManager
to allow for cleanup, but should not keep a reference
to the BuildContext
.getServiceManager
in interface BuildContext
getServiceManager
in interface SearchFactoryState
public SearchFactoryImplementor getUninitializedSearchFactory()
BuildContext
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, because the configuration can be dynamically updated and new changes made available.
For example, prefer:
void method() {
int size = sfi.getDirectoryProviders().size();
}
over
void method() {
int size = directoryProviders.size();
}
where directoryProviders is a class variable.getUninitializedSearchFactory
in interface BuildContext
public boolean isJMXEnabled()
isJMXEnabled
in interface SearchFactoryImplementor
public boolean isDirtyChecksEnabled()
isDirtyChecksEnabled
in interface SearchFactoryImplementor
true
if we are allowed to inspect entity state to skip some indexing operations.
Can be disabled to get pre-3.4 behavior which always rebuilds the document.public boolean isStopped()
isStopped
in interface SearchFactoryIntegrator
public boolean isTransactionManagerExpected()
isTransactionManagerExpected
in interface SearchFactoryState
isTransactionManagerExpected
in interface WorkerBuildContext
true
if a transaction manager is expected, false
otherwise.SearchConfiguration.isTransactionManagerExpected()
public IndexManagerHolder getAllIndexesManager()
getAllIndexesManager
in interface SearchFactoryImplementor
getAllIndexesManager
in interface BuildContext
getAllIndexesManager
in interface SearchFactoryState
IndexManagerHolder
which gives access to all index managers known to this factorypublic IndexManagerHolder getIndexManagerHolder()
getIndexManagerHolder
in interface SearchFactoryImplementor
IndexManagerHolder
which gives access to all index managers known to this factorypublic EntityIndexBinding getSafeIndexBindingForEntity(Class<?> entityType)
public ErrorHandler getErrorHandler()
SearchFactoryIntegrator
getErrorHandler
in interface BuildContext
getErrorHandler
in interface SearchFactoryState
getErrorHandler
in interface SearchFactoryIntegrator
public IndexReaderAccessor getIndexReaderAccessor()
SearchFactory
getIndexReaderAccessor
in interface SearchFactory
public IndexedTypeDescriptor getIndexedTypeDescriptor(Class<?> entityType)
SearchFactory
getIndexedTypeDescriptor
in interface SearchFactory
entityType
- the entity for which to retrieve the descriptornull
IndexedEntityDescriptor
. This method can also be called for non indexed types.
To determine whether the entity is actually indexed IndexedTypeDescriptor.isIndexed()
can be used.public Set<Class<?>> getIndexedTypes()
SearchFactory
getIndexedTypes
in interface SearchFactory
public InstanceInitializer getInstanceInitializer()
getInstanceInitializer
in interface SearchFactoryImplementor
getInstanceInitializer
in interface SearchFactoryState
getInstanceInitializer
in interface WorkerBuildContext
InstanceInitializer
for class/object initialization.public TimeoutExceptionFactory getDefaultTimeoutExceptionFactory()
getDefaultTimeoutExceptionFactory
in interface SearchFactoryState
getDefaultTimeoutExceptionFactory
in interface SearchFactoryIntegrator
public TimingSource getTimingSource()
getTimingSource
in interface SearchFactoryImplementor
getTimingSource
in interface SearchFactoryState
public SearchMapping getProgrammaticMapping()
getProgrammaticMapping
in interface SearchFactoryState
public boolean isIndexMetadataComplete()
isIndexMetadataComplete
in interface SearchFactoryState
isIndexMetadataComplete
in interface WorkerBuildContext
true
if it is safe to assume that the information we have about
index metadata is accurate. This should be set to false for example if the index
could contain Documents related to types not known to this SearchFactory instance.SearchConfiguration.isIndexMetadataComplete()
public boolean isIdProvidedImplicit()
isIdProvidedImplicit
in interface SearchFactoryState
public IndexManagerFactory getIndexManagerFactory()
getIndexManagerFactory
in interface SearchFactoryState
Copyright © 2006–2016 Hibernate. All rights reserved.