public class MutableSearchFactory extends Object implements ExtendedSearchIntegratorWithShareableState, SearchIntegrator, WorkerBuildContext
Constructor and Description |
---|
MutableSearchFactory() |
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() |
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 |
void |
setDelegate(ExtendedSearchIntegratorWithShareableState delegate) |
<T> T |
unwrap(Class<T> cls)
Unwraps some internal Hibernate Search types.
|
public void setDelegate(ExtendedSearchIntegratorWithShareableState delegate)
public Map<String,FilterDef> getFilterDefinitions()
getFilterDefinitions
in interface SearchFactoryState
public Map<Class<?>,EntityIndexBinding> getIndexBindings()
ExtendedSearchIntegrator
getIndexBindings
in interface ExtendedSearchIntegrator
getIndexBindings
in interface SearchFactoryState
public EntityIndexBinding getIndexBinding(Class<?> entityType)
SearchIntegrator
getIndexBinding
in interface SearchIntegrator
entityType
- 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 ExtendedSearchIntegrator
public Worker getWorker()
SearchIntegrator
getWorker
in interface SearchFactoryState
getWorker
in interface SearchIntegrator
Worker
public FilterCachingStrategy getFilterCachingStrategy()
getFilterCachingStrategy
in interface ExtendedSearchIntegrator
getFilterCachingStrategy
in interface SearchFactoryState
public Map<String,Analyzer> getAnalyzers()
getAnalyzers
in interface SearchFactoryState
public int getCacheBitResultsSize()
getCacheBitResultsSize
in interface SearchFactoryState
public Properties getConfigurationProperties()
getConfigurationProperties
in interface ExtendedSearchIntegrator
getConfigurationProperties
in interface SearchFactoryState
public FilterDef getFilterDefinition(String name)
getFilterDefinition
in interface ExtendedSearchIntegrator
public ExtendedSearchIntegrator getUninitializedSearchIntegrator()
BuildContext
ExtendedSearchintegrator
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 BuildContext
ExtendedSearchIntegrator
instance@Deprecated public String getIndexingStrategy()
getIndexingStrategy
in interface BuildContext
public IndexingMode getIndexingMode()
getIndexingMode
in interface BuildContext
getIndexingMode
in interface SearchFactoryState
getIndexingMode
in interface SearchIntegrator
Environment.INDEXING_STRATEGY
.public void close()
SearchIntegrator
close
in interface AutoCloseable
close
in interface SearchIntegrator
public HSQuery createHSQuery()
SearchIntegrator
createHSQuery
in interface SearchIntegrator
public int getFilterCacheBitResultsSize()
getFilterCacheBitResultsSize
in interface ExtendedSearchIntegrator
public Set<Class<?>> getIndexedTypesPolymorphic(Class<?>[] classes)
ExtendedSearchIntegrator
Indexed
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 ExtendedSearchIntegrator
classes
- a list of typespublic BatchBackend makeBatchBackend(MassIndexerProgressMonitor progressMonitor)
makeBatchBackend
in interface SearchIntegrator
public boolean isJMXEnabled()
isJMXEnabled
in interface ExtendedSearchIntegrator
true
if JMX is enabledpublic StatisticsImplementor getStatisticsImplementor()
ExtendedSearchIntegrator
getStatisticsImplementor
in interface ExtendedSearchIntegrator
public PolymorphicIndexHierarchy getIndexHierarchy()
getIndexHierarchy
in interface SearchFactoryState
public ServiceManager getServiceManager()
SearchIntegrator
getServiceManager
in interface BuildContext
getServiceManager
in interface SearchFactoryState
getServiceManager
in interface SearchIntegrator
public DatabaseRetrievalMethod getDefaultDatabaseRetrievalMethod()
ExtendedSearchIntegrator
DatabaseRetrievalMethod
.
This is either the system default or the default specified via the configuration property
Environment.DATABASE_RETRIEVAL_METHOD
.getDefaultDatabaseRetrievalMethod
in interface ExtendedSearchIntegrator
DatabaseRetrievalMethod
.public ObjectLookupMethod getDefaultObjectLookupMethod()
ExtendedSearchIntegrator
ObjectLookupMethod
.
This is either the system default or the default specified via the configuration property
Environment.OBJECT_LOOKUP_METHOD
.getDefaultObjectLookupMethod
in interface ExtendedSearchIntegrator
OBJECT_LOOKUP_METHOD
.public void optimize()
SearchIntegrator
optimize
in interface SearchIntegrator
public void optimize(Class entityType)
SearchIntegrator
entityType
optimize
in interface SearchIntegrator
entityType
- the entity type (index) to optimizepublic Analyzer getAnalyzer(String name)
SearchIntegrator
getAnalyzer
in interface SearchIntegrator
name
- the name of the analyzerpublic Analyzer getAnalyzer(Class<?> clazz)
SearchIntegrator
getAnalyzer
in interface SearchIntegrator
clazz
- The class for which to retrieve the analyzer.public QueryContextBuilder buildQueryBuilder()
buildQueryBuilder
in interface SearchIntegrator
public Statistics getStatistics()
SearchIntegrator
getStatistics
in interface SearchIntegrator
public Map<Class<?>,DocumentBuilderContainedEntity> getDocumentBuildersContainedEntities()
getDocumentBuildersContainedEntities
in interface SearchFactoryState
public void addClasses(Class<?>... classes)
SearchIntegrator
addClasses
in interface SearchIntegrator
classes
- the classes to add to the SearchIntegrator
public boolean isDirtyChecksEnabled()
isDirtyChecksEnabled
in interface ExtendedSearchIntegrator
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 SearchIntegrator
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 BuildContext
getAllIndexesManager
in interface SearchFactoryState
IndexManagerHolder
, storing all IndexManager
instances.public IndexManagerHolder getIndexManagerHolder()
getIndexManagerHolder
in interface ExtendedSearchIntegrator
IndexManagerHolder
which gives access to all index managers known to this factorypublic ErrorHandler getErrorHandler()
SearchIntegrator
getErrorHandler
in interface BuildContext
getErrorHandler
in interface SearchFactoryState
getErrorHandler
in interface SearchIntegrator
public IndexReaderAccessor getIndexReaderAccessor()
SearchIntegrator
getIndexReaderAccessor
in interface SearchIntegrator
public IndexedTypeDescriptor getIndexedTypeDescriptor(Class<?> entityType)
SearchIntegrator
getIndexedTypeDescriptor
in interface SearchIntegrator
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()
SearchIntegrator
getIndexedTypes
in interface SearchIntegrator
public InstanceInitializer getInstanceInitializer()
getInstanceInitializer
in interface ExtendedSearchIntegrator
getInstanceInitializer
in interface SearchFactoryState
getInstanceInitializer
in interface WorkerBuildContext
InstanceInitializer
for class/object initialization.public TimeoutExceptionFactory getDefaultTimeoutExceptionFactory()
SearchIntegrator
getDefaultTimeoutExceptionFactory
in interface SearchFactoryState
getDefaultTimeoutExceptionFactory
in interface SearchIntegrator
public TimingSource getTimingSource()
getTimingSource
in interface ExtendedSearchIntegrator
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 isDeleteByTermEnforced()
isDeleteByTermEnforced
in interface SearchFactoryState
isDeleteByTermEnforced
in interface WorkerBuildContext
true
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 SearchFactoryState
public IndexManagerFactory getIndexManagerFactory()
getIndexManagerFactory
in interface SearchFactoryState
public boolean enlistWorkerInTransaction()
enlistWorkerInTransaction
in interface SearchFactoryState
enlistWorkerInTransaction
in interface WorkerBuildContext
true
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)
SearchIntegrator
IndexManager
using the namegetIndexManager
in interface SearchIntegrator
indexName
- the name of the IndexManager
IndexManager
public boolean isIndexUninvertingAllowed()
ExtendedSearchIntegrator
isIndexUninvertingAllowed
in interface ExtendedSearchIntegrator
public <T> T unwrap(Class<T> cls)
SearchIntegrator
unwrap
in interface SearchIntegrator
T
- the type of the unwrapped objectcls
- the class of the internal object to unwrapCopyright © 2006-2017 Red Hat, Inc. All Rights Reserved