public class MutableSearchFactory extends Object implements ExtendedSearchIntegratorWithShareableState, SearchIntegrator, WorkerBuildContext
Constructor and Description |
---|
MutableSearchFactory() |
public void setDelegate(ExtendedSearchIntegratorWithShareableState delegate)
public Map<String,FilterDef> getFilterDefinitions()
getFilterDefinitions
in interface SearchFactoryState
public IndexedTypeMap<EntityIndexBinding> getIndexBindings()
SearchIntegrator
getIndexBindings
in interface SearchFactoryState
getIndexBindings
in interface SearchIntegrator
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<IndexManagerType,SearchIntegration> getIntegrations()
ExtendedSearchIntegrator
getIntegrations
in interface ExtendedSearchIntegrator
getIntegrations
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
instancepublic 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(Query luceneQuery, Class<?>... entities)
SearchIntegrator
This method DOES support non-Lucene backends (e.g. Elasticsearch).
The returned object uses fluent APIs to define additional query settings.
Be aware that some backends may not implement HSQuery.luceneQuery(Query)
,
in which case the query provided here cannot be overridden.
createHSQuery
in interface SearchIntegrator
luceneQuery
- the full-text engine queryentities
- the targeted entity typespublic HSQuery createHSQuery(Query luceneQuery, IndexedTypeMap<CustomTypeMetadata> types)
SearchIntegrator
This method DOES support non-Lucene backends (e.g. Elasticsearch).
The returned object uses fluent APIs to define additional query settings.
Be aware that some backends may not implement HSQuery.luceneQuery(Query)
,
in which case the query provided here cannot be overridden.
createHSQuery
in interface SearchIntegrator
luceneQuery
- the full-text engine querytypes
- the targeted entity types, mapped to (potentially null) overridden metadatapublic int getFilterCacheBitResultsSize()
getFilterCacheBitResultsSize
in interface ExtendedSearchIntegrator
public 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 TypeHierarchy getConfiguredTypeHierarchy()
getConfiguredTypeHierarchy
in interface SearchFactoryState
public TypeHierarchy getIndexedTypeHierarchy()
getIndexedTypeHierarchy
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(IndexedTypeIdentifier 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 SearchIntegration getIntegration(IndexManagerType indexManagerType)
ExtendedSearchIntegrator
getIntegration
in interface ExtendedSearchIntegrator
indexManagerType
- the index manager type for which to retrieve the integrationpublic Analyzer getAnalyzer(IndexedTypeIdentifier type)
SearchIntegrator
getAnalyzer
in interface SearchIntegrator
type
- The indexed type identifier for which to retrieve the analyzer.public QueryContextBuilder buildQueryBuilder()
buildQueryBuilder
in interface SearchIntegrator
public Statistics getStatistics()
SearchIntegrator
getStatistics
in interface SearchFactoryState
getStatistics
in interface SearchIntegrator
public IndexedTypeMap<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 IndexedTypeSet getIndexedTypeIdentifiers()
SearchIntegrator
getIndexedTypeIdentifiers
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 boolean isMultitenancyEnabled()
isMultitenancyEnabled
in interface SearchFactoryState
isMultitenancyEnabled
in interface WorkerBuildContext
true
if multitenancy
should be enabled. When in doubt, this should return true
.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()
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 unwrappublic LuceneWorkSerializer getWorkSerializer()
getWorkSerializer
in interface SearchIntegrator
public LuceneWorkSerializer getWorkSerializerState()
getWorkSerializerState
in interface SearchFactoryState
public OperationDispatcher createRemoteOperationDispatcher(Predicate<IndexManager> indexManagerFilter)
createRemoteOperationDispatcher
in interface SearchIntegrator
indexManagerFilter
- A predicate allowing to exclude index managers from
dispatching. Works will not be applied to these index managers.public EntityIndexBinding getIndexBinding(IndexedTypeIdentifier 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 IndexedTypeSet getConfiguredTypesPolymorphic(IndexedTypeSet types)
ExtendedSearchIntegrator
"Configured" types are types that Hibernate Search was instructed to take into consideration,
i.e. types returned by SearchConfiguration.getClassMappings()
.
getConfiguredTypesPolymorphic
in interface ExtendedSearchIntegrator
public IndexedTypeSet getIndexedTypesPolymorphic(IndexedTypeSet queryTarget)
ExtendedSearchIntegrator
"Configured" types are types that Hibernate Search was instructed to take into consideration,
i.e. types returned by SearchConfiguration.getClassMappings()
.
"Indexed" types are configured types that happened to be annotated with @Indexed
,
or similarly configured through a programmatic mapping.
Note: the fact that a given type is configured or indexed doesn't mean that its subtypes are, too. Each type must be configured explicitly.
getIndexedTypesPolymorphic
in interface ExtendedSearchIntegrator
queryTarget
- the target setpublic DocumentBuilderContainedEntity getDocumentBuilderContainedEntity(IndexedTypeIdentifier entityType)
getDocumentBuilderContainedEntity
in interface ExtendedSearchIntegrator
public ScopedAnalyzerReference getAnalyzerReference(IndexedTypeIdentifier type)
ExtendedSearchIntegrator
getAnalyzerReference
in interface ExtendedSearchIntegrator
type
- The type for which to retrieve the analyzer.public IndexedTypeDescriptor getIndexedTypeDescriptor(IndexedTypeIdentifier typeId)
SearchIntegrator
getIndexedTypeDescriptor
in interface SearchIntegrator
typeId
- the identification of the indexed 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.Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved