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(org.apache.lucene.search.Query luceneQuery,
Class<?>... entityTypes)
Return an Hibernate Search query object.
|
HSQuery |
createHSQuery(org.apache.lucene.search.Query luceneQuery,
IndexedTypeMap<CustomTypeMetadata> types)
Return an Hibernate Search query object.
|
OperationDispatcher |
createRemoteOperationDispatcher(Predicate<IndexManager> predicate) |
boolean |
enlistWorkerInTransaction() |
IndexManagerHolder |
getAllIndexesManager() |
org.apache.lucene.analysis.Analyzer |
getAnalyzer(IndexedTypeIdentifier type)
Retrieves the scoped analyzer for a given indexed type.
|
org.apache.lucene.analysis.Analyzer |
getAnalyzer(String name)
Retrieve an analyzer instance by its definition name
|
ScopedAnalyzerReference |
getAnalyzerReference(IndexedTypeIdentifier type)
Retrieve the scoped analyzer reference for a given indexed type.
|
int |
getCacheBitResultsSize() |
Properties |
getConfigurationProperties() |
TypeHierarchy |
getConfiguredTypeHierarchy() |
IndexedTypeSet |
getConfiguredTypesPolymorphic(IndexedTypeSet types)
Given a set of target entities, return the set of configured subtypes.
|
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(IndexedTypeIdentifier entityType) |
IndexedTypeMap<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(IndexedTypeIdentifier entityType)
Returns the entity to index binding for the given type.
|
IndexedTypeMap<EntityIndexBinding> |
getIndexBindings()
Returns a map of all known entity index binding (indexed entities) keyed against the indexed type
|
IndexedTypeDescriptor |
getIndexedTypeDescriptor(IndexedTypeIdentifier type)
Returns a descriptor for the specified entity type describing its indexed state.
|
TypeHierarchy |
getIndexedTypeHierarchy() |
IndexedTypeSet |
getIndexedTypeIdentifiers()
Returns the set of currently indexed types.
|
IndexedTypeSet |
getIndexedTypesPolymorphic(IndexedTypeSet types)
Given a set of target entities, return the set of configured subtypes that are indexed.
|
IndexingMode |
getIndexingMode() |
IndexManager |
getIndexManager(String indexName)
Get an
IndexManager using the name |
IndexManagerFactory |
getIndexManagerFactory() |
IndexManagerHolder |
getIndexManagerHolder() |
IndexReaderAccessor |
getIndexReaderAccessor()
Provides access to the IndexReader API
|
InstanceInitializer |
getInstanceInitializer() |
SearchIntegration |
getIntegration(IndexManagerType indexManagerType)
Retrieve the integration information for a given index manager type.
|
Map<IndexManagerType,SearchIntegration> |
getIntegrations()
Returns a map of all known integrations keyed against the indexed manager type
|
SearchMapping |
getProgrammaticMapping() |
EntityIndexBinding |
getSafeIndexBindingForEntity(Class<?> entityType)
Deprecated.
|
EntityIndexBinding |
getSafeIndexBindingForEntity(IndexedTypeIdentifier type) |
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.
|
LuceneWorkSerializer |
getWorkSerializer() |
LuceneWorkSerializer |
getWorkSerializerState() |
boolean |
isDeleteByTermEnforced() |
boolean |
isDirtyChecksEnabled() |
boolean |
isIdProvidedImplicit() |
boolean |
isIndexMetadataComplete() |
boolean |
isIndexUninvertingAllowed() |
boolean |
isJMXEnabled() |
boolean |
isMultitenancyEnabled() |
boolean |
isStopped() |
boolean |
isTransactionManagerExpected() |
BatchBackend |
makeBatchBackend(MassIndexerProgressMonitor progressMonitor) |
void |
optimize()
Optimize all indexes
|
void |
optimize(IndexedTypeIdentifier 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 SearchFactoryStatepublic 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(org.apache.lucene.search.Query luceneQuery, Class<?>... entityTypes)
SearchIntegratorThis 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 SearchIntegratorluceneQuery - the full-text engine queryentityTypes - the targeted entity typespublic HSQuery createHSQuery(org.apache.lucene.search.Query luceneQuery, IndexedTypeMap<CustomTypeMetadata> types)
SearchIntegratorThis 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 SearchIntegratorluceneQuery - the full-text engine querytypes - the targeted entity types, mapped to (potentially null) overridden metadatapublic IndexedTypeMap<DocumentBuilderContainedEntity> getDocumentBuildersContainedEntities()
getDocumentBuildersContainedEntities in interface SearchFactoryStatepublic IndexedTypeMap<EntityIndexBinding> getIndexBindings()
SearchIntegratorgetIndexBindings in interface SearchFactoryStategetIndexBindings in interface SearchIntegratorpublic EntityIndexBinding getIndexBinding(IndexedTypeIdentifier 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(IndexedTypeIdentifier 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(IndexedTypeIdentifier entityType)
SearchIntegratorentityTypeoptimize in interface SearchIntegratorentityType - the entity type (index) to optimizepublic org.apache.lucene.analysis.Analyzer getAnalyzer(String name)
SearchIntegratorgetAnalyzer in interface SearchIntegratorname - the name of the analyzerpublic SearchIntegration getIntegration(IndexManagerType indexManagerType)
ExtendedSearchIntegratorgetIntegration in interface ExtendedSearchIntegratorindexManagerType - the index manager type for which to retrieve the integrationpublic org.apache.lucene.analysis.Analyzer getAnalyzer(IndexedTypeIdentifier type)
SearchIntegratorgetAnalyzer in interface SearchIntegratortype - The indexed type identifier for which to retrieve the analyzer.public ScopedAnalyzerReference getAnalyzerReference(IndexedTypeIdentifier type)
ExtendedSearchIntegratorgetAnalyzerReference in interface ExtendedSearchIntegratortype - The type for which to retrieve the analyzer.public QueryContextBuilder buildQueryBuilder()
buildQueryBuilder in interface SearchIntegratorpublic Statistics getStatistics()
SearchIntegratorgetStatistics in interface SearchFactoryStategetStatistics in interface SearchIntegratorpublic StatisticsImplementor getStatisticsImplementor()
ExtendedSearchIntegratorgetStatisticsImplementor in interface ExtendedSearchIntegratorpublic FilterCachingStrategy getFilterCachingStrategy()
getFilterCachingStrategy in interface ExtendedSearchIntegratorgetFilterCachingStrategy in interface SearchFactoryStatepublic Map<IndexManagerType,SearchIntegration> getIntegrations()
ExtendedSearchIntegratorgetIntegrations in interface ExtendedSearchIntegratorgetIntegrations 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 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 ExtendedSearchIntegratorpublic IndexedTypeSet getIndexedTypesPolymorphic(IndexedTypeSet types)
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 ExtendedSearchIntegratortypes - the target setpublic BatchBackend makeBatchBackend(MassIndexerProgressMonitor progressMonitor)
makeBatchBackend in interface SearchIntegratorpublic TypeHierarchy getConfiguredTypeHierarchy()
getConfiguredTypeHierarchy in interface SearchFactoryStatepublic TypeHierarchy getIndexedTypeHierarchy()
getIndexedTypeHierarchy 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 factory@Deprecated public EntityIndexBinding getSafeIndexBindingForEntity(Class<?> entityType)
public EntityIndexBinding getSafeIndexBindingForEntity(IndexedTypeIdentifier type)
public ErrorHandler getErrorHandler()
SearchIntegratorgetErrorHandler in interface BuildContextgetErrorHandler in interface SearchFactoryStategetErrorHandler in interface SearchIntegratorpublic IndexReaderAccessor getIndexReaderAccessor()
SearchIntegratorgetIndexReaderAccessor in interface SearchIntegratorpublic IndexedTypeDescriptor getIndexedTypeDescriptor(IndexedTypeIdentifier type)
SearchIntegratorgetIndexedTypeDescriptor in interface SearchIntegratortype - 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.public IndexedTypeSet getIndexedTypeIdentifiers()
SearchIntegratorgetIndexedTypeIdentifiers 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 boolean isMultitenancyEnabled()
isMultitenancyEnabled in interface SearchFactoryStateisMultitenancyEnabled in interface WorkerBuildContexttrue if multitenancy
should be enabled. When in doubt, this should return true.public 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()
isIndexUninvertingAllowed 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 unwrappublic LuceneWorkSerializer getWorkSerializer()
getWorkSerializer in interface SearchIntegratorpublic LuceneWorkSerializer getWorkSerializerState()
getWorkSerializerState in interface SearchFactoryStatepublic OperationDispatcher createRemoteOperationDispatcher(Predicate<IndexManager> predicate)
createRemoteOperationDispatcher in interface SearchIntegratorpredicate - A predicate allowing to exclude index managers from
dispatching. Works will not be applied to these index managers.Copyright © 2006–2017 Hibernate. All rights reserved.