public class ImmutableSearchFactory extends Object implements ExtendedSearchIntegratorWithShareableState, WorkerBuildContext
MutableSearchFactory| Constructor and Description |
|---|
ImmutableSearchFactory(SearchFactoryState state) |
| Modifier and Type | Method and Description |
|---|---|
void |
addClasses(Class<?>... classes)
Add the following classes to the SearchIntegrator.
|
QueryContextBuilder |
buildQueryBuilder() |
void |
close()
Shuts down all workers and releases all resources.
|
HSQuery |
createHSQuery()
Return an Hibernate Search query object.
|
boolean |
enlistWorkerInTransaction() |
IndexManagerHolder |
getAllIndexesManager() |
Analyzer |
getAnalyzer(Class<?> clazz)
Retrieves the scoped analyzer for a given class.
|
Analyzer |
getAnalyzer(String name)
Retrieve an analyzer instance by its definition name
|
Map<String,Analyzer> |
getAnalyzers() |
int |
getCacheBitResultsSize() |
Properties |
getConfigurationProperties() |
DatabaseRetrievalMethod |
getDefaultDatabaseRetrievalMethod()
Returns the default
DatabaseRetrievalMethod. |
ObjectLookupMethod |
getDefaultObjectLookupMethod()
Returns the default
ObjectLookupMethod. |
TimeoutExceptionFactory |
getDefaultTimeoutExceptionFactory()
Useful if you need to create custom exception types to represent query timeouts.
|
DocumentBuilderContainedEntity |
getDocumentBuilderContainedEntity(Class 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<?>,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)
Given a set of target entities, return the set of indexed types following our
polymorphism rules for propagation of the
Indexed annotation:
It returns an empty set if none of the target entities is indexed, nor any of their sub types. |
PolymorphicIndexHierarchy |
getIndexHierarchy() |
IndexingMode |
getIndexingMode() |
String |
getIndexingStrategy()
Deprecated.
|
IndexManager |
getIndexManager(String indexName)
Get an
IndexManager using the name |
IndexManagerFactory |
getIndexManagerFactory() |
IndexManagerHolder |
getIndexManagerHolder() |
IndexReaderAccessor |
getIndexReaderAccessor()
Provides access to the IndexReader API
|
InstanceInitializer |
getInstanceInitializer() |
SearchMapping |
getProgrammaticMapping() |
EntityIndexBinding |
getSafeIndexBindingForEntity(Class<?> entityType) |
ServiceManager |
getServiceManager()
Returns the service manager.
|
Statistics |
getStatistics()
Retrieve the statistics instance for this factory.
|
StatisticsImplementor |
getStatisticsImplementor()
Retrieve the statistics implementor instance for this factory.
|
TimingSource |
getTimingSource() |
ExtendedSearchIntegrator |
getUninitializedSearchIntegrator()
Returns the
ExtendedSearchintegrator instance. |
Worker |
getWorker()
The Worker is the entry point to apply writes and updates to the indexes.
|
boolean |
isDeleteByTermEnforced() |
boolean |
isDirtyChecksEnabled() |
boolean |
isIdProvidedImplicit() |
boolean |
isIndexMetadataComplete() |
boolean |
isIndexUninvertingAllowed()
Whether index uninverting should be done when running queries with sorts not covered by the configured sortable
fields.
|
boolean |
isJMXEnabled() |
boolean |
isStopped() |
boolean |
isTransactionManagerExpected() |
BatchBackend |
makeBatchBackend(MassIndexerProgressMonitor progressMonitor) |
void |
optimize()
Optimize all indexes
|
void |
optimize(Class entityType)
Optimize the index holding
entityType |
<T> T |
unwrap(Class<T> cls)
Unwraps some internal Hibernate Search types.
|
public ImmutableSearchFactory(SearchFactoryState state)
public Map<String,FilterDef> getFilterDefinitions()
getFilterDefinitions in interface SearchFactoryState@Deprecated public String getIndexingStrategy()
getIndexingStrategy in interface BuildContextpublic IndexingMode getIndexingMode()
getIndexingMode in interface BuildContextgetIndexingMode in interface SearchFactoryStategetIndexingMode in interface SearchIntegratorEnvironment.INDEXING_STRATEGY.public void close()
SearchIntegratorclose in interface AutoCloseableclose in interface SearchIntegratorpublic HSQuery createHSQuery()
SearchIntegratorcreateHSQuery in interface SearchIntegratorpublic Map<Class<?>,DocumentBuilderContainedEntity> getDocumentBuildersContainedEntities()
getDocumentBuildersContainedEntities in interface SearchFactoryStatepublic Map<Class<?>,EntityIndexBinding> getIndexBindings()
ExtendedSearchIntegratorgetIndexBindings in interface ExtendedSearchIntegratorgetIndexBindings in interface SearchFactoryStatepublic EntityIndexBinding getIndexBinding(Class<?> entityType)
SearchIntegratorgetIndexBinding in interface SearchIntegratorentityType - the type for which to retrieve the bindingnull is returned for types which are unindexed or
unknown.public DocumentBuilderContainedEntity getDocumentBuilderContainedEntity(Class entityType)
getDocumentBuilderContainedEntity in interface ExtendedSearchIntegratorpublic void addClasses(Class<?>... classes)
SearchIntegratoraddClasses in interface SearchIntegratorclasses - the classes to add to the SearchIntegratorpublic Worker getWorker()
SearchIntegratorgetWorker in interface SearchFactoryStategetWorker in interface SearchIntegratorWorkerpublic void optimize()
SearchIntegratoroptimize in interface SearchIntegratorpublic void optimize(Class entityType)
SearchIntegratorentityTypeoptimize in interface SearchIntegratorentityType - the entity type (index) to optimizepublic Analyzer getAnalyzer(String name)
SearchIntegratorgetAnalyzer in interface SearchIntegratorname - the name of the analyzerpublic Analyzer getAnalyzer(Class<?> clazz)
SearchIntegratorgetAnalyzer in interface SearchIntegratorclazz - The class for which to retrieve the analyzer.public QueryContextBuilder buildQueryBuilder()
buildQueryBuilder in interface SearchIntegratorpublic Statistics getStatistics()
SearchIntegratorgetStatistics in interface SearchIntegratorpublic StatisticsImplementor getStatisticsImplementor()
ExtendedSearchIntegratorgetStatisticsImplementor in interface ExtendedSearchIntegratorpublic FilterCachingStrategy getFilterCachingStrategy()
getFilterCachingStrategy in interface ExtendedSearchIntegratorgetFilterCachingStrategy in interface SearchFactoryStatepublic Map<String,Analyzer> getAnalyzers()
getAnalyzers in interface SearchFactoryStatepublic int getCacheBitResultsSize()
getCacheBitResultsSize in interface SearchFactoryStatepublic Properties getConfigurationProperties()
getConfigurationProperties in interface ExtendedSearchIntegratorgetConfigurationProperties in interface SearchFactoryStatepublic FilterDef getFilterDefinition(String name)
getFilterDefinition in interface ExtendedSearchIntegratorpublic int getFilterCacheBitResultsSize()
getFilterCacheBitResultsSize in interface ExtendedSearchIntegratorpublic Set<Class<?>> getIndexedTypesPolymorphic(Class<?>[] classes)
ExtendedSearchIntegratorIndexed annotation:
It returns an empty set if none of the target entities is indexed, nor any of their sub types.
Each of the classes of the argument is returned iff explicitly marked as indexed.
Each of the known subtypes of these classes which are explicitly marked as indexed are
added to the returned set.
The Indexed annotation is not inherited by subtypes which don't explicitly have it.
Passing Object.class among the parameters will have the returned set contain all known indexed types.getIndexedTypesPolymorphic in interface ExtendedSearchIntegratorclasses - a list of typespublic BatchBackend makeBatchBackend(MassIndexerProgressMonitor progressMonitor)
makeBatchBackend in interface SearchIntegratorpublic PolymorphicIndexHierarchy getIndexHierarchy()
getIndexHierarchy in interface SearchFactoryStatepublic ServiceManager getServiceManager()
SearchIntegratorgetServiceManager in interface BuildContextgetServiceManager in interface SearchFactoryStategetServiceManager in interface SearchIntegratorpublic DatabaseRetrievalMethod getDefaultDatabaseRetrievalMethod()
ExtendedSearchIntegratorDatabaseRetrievalMethod.
This is either the system default or the default specified via the configuration property
Environment.DATABASE_RETRIEVAL_METHOD.getDefaultDatabaseRetrievalMethod in interface ExtendedSearchIntegratorDatabaseRetrievalMethod.public ObjectLookupMethod getDefaultObjectLookupMethod()
ExtendedSearchIntegratorObjectLookupMethod.
This is either the system default or the default specified via the configuration property
Environment.OBJECT_LOOKUP_METHOD.getDefaultObjectLookupMethod in interface ExtendedSearchIntegratorOBJECT_LOOKUP_METHOD.public ExtendedSearchIntegrator getUninitializedSearchIntegrator()
BuildContextExtendedSearchintegrator instance. Do not use until after the initialize and/or start method is
fully executed.
Implementations should not cache values provided by the ExtendedSearchintegrator, 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.getUninitializedSearchIntegrator in interface BuildContextExtendedSearchIntegrator instancepublic boolean isJMXEnabled()
isJMXEnabled in interface ExtendedSearchIntegratortrue if JMX is enabledpublic boolean isDirtyChecksEnabled()
isDirtyChecksEnabled in interface ExtendedSearchIntegratortrue 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 SearchIntegratorpublic boolean isTransactionManagerExpected()
isTransactionManagerExpected in interface SearchFactoryStateisTransactionManagerExpected in interface WorkerBuildContexttrue if a transaction manager is expected, false otherwise.SearchConfiguration.isTransactionManagerExpected()public IndexManagerHolder getAllIndexesManager()
getAllIndexesManager in interface BuildContextgetAllIndexesManager in interface SearchFactoryStateIndexManagerHolder, storing all IndexManager instances.public IndexManagerHolder getIndexManagerHolder()
getIndexManagerHolder in interface ExtendedSearchIntegratorIndexManagerHolder which gives access to all index managers known to this factorypublic EntityIndexBinding getSafeIndexBindingForEntity(Class<?> entityType)
public ErrorHandler getErrorHandler()
SearchIntegratorgetErrorHandler in interface BuildContextgetErrorHandler in interface SearchFactoryStategetErrorHandler in interface SearchIntegratorpublic IndexReaderAccessor getIndexReaderAccessor()
SearchIntegratorgetIndexReaderAccessor in interface SearchIntegratorpublic IndexedTypeDescriptor getIndexedTypeDescriptor(Class<?> entityType)
SearchIntegratorgetIndexedTypeDescriptor in interface SearchIntegratorentityType - 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()
SearchIntegratorgetIndexedTypes in interface SearchIntegratorpublic InstanceInitializer getInstanceInitializer()
getInstanceInitializer in interface ExtendedSearchIntegratorgetInstanceInitializer in interface SearchFactoryStategetInstanceInitializer in interface WorkerBuildContextInstanceInitializer for class/object initialization.public TimeoutExceptionFactory getDefaultTimeoutExceptionFactory()
SearchIntegratorgetDefaultTimeoutExceptionFactory in interface SearchFactoryStategetDefaultTimeoutExceptionFactory in interface SearchIntegratorpublic TimingSource getTimingSource()
getTimingSource in interface ExtendedSearchIntegratorgetTimingSource in interface SearchFactoryStatepublic SearchMapping getProgrammaticMapping()
getProgrammaticMapping in interface SearchFactoryStatepublic boolean isIndexMetadataComplete()
isIndexMetadataComplete in interface SearchFactoryStateisIndexMetadataComplete in interface WorkerBuildContexttrue 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 isDeleteByTermEnforced()
isDeleteByTermEnforced in interface SearchFactoryStateisDeleteByTermEnforced in interface WorkerBuildContexttrue if regardless of isIndexMetadataComplete and the number
of types present in the index it is safe to delete by term given that the underlying
store guarantees uniqueness of idspublic boolean isIdProvidedImplicit()
isIdProvidedImplicit in interface SearchFactoryStatepublic IndexManagerFactory getIndexManagerFactory()
getIndexManagerFactory in interface SearchFactoryStatepublic boolean enlistWorkerInTransaction()
enlistWorkerInTransaction in interface SearchFactoryStateenlistWorkerInTransaction in interface WorkerBuildContexttrue if the worker and the backend enlist their work in the current transaction;
If false, the worker will still use the transaction as context but will execute the
workload when the transaction commits.public IndexManager getIndexManager(String indexName)
SearchIntegratorIndexManager using the namegetIndexManager in interface SearchIntegratorindexName - the name of the IndexManagerIndexManagerpublic boolean isIndexUninvertingAllowed()
ExtendedSearchIntegratorisIndexUninvertingAllowed in interface ExtendedSearchIntegratorpublic <T> T unwrap(Class<T> cls)
SearchIntegratorunwrap in interface SearchIntegratorT - the type of the unwrapped objectcls - the class of the internal object to unwrapCopyright © 2006-2017 Red Hat, Inc. All Rights Reserved