public interface SearchIntegrator extends AutoCloseable
org.hibernate.search.SearchFactory
contract to
its clients.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 fullTextQuery,
Class<?>... entityTypes)
Return an Hibernate Search query object.
|
HSQuery |
createHSQuery(org.apache.lucene.search.Query fullTextQuery,
IndexedTypeMap<CustomTypeMetadata> types)
Return an Hibernate Search query object.
|
OperationDispatcher |
createRemoteOperationDispatcher(Predicate<IndexManager> indexManagerFilter) |
org.apache.lucene.analysis.Analyzer |
getAnalyzer(IndexedTypeIdentifier typeId)
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
|
TimeoutExceptionFactory |
getDefaultTimeoutExceptionFactory()
Useful if you need to create custom exception types to represent query timeouts.
|
ErrorHandler |
getErrorHandler()
Used to catch exceptions in all synchronous operations; but default they are logged, the user
can configure alternative error management means.
|
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 typeId)
Returns a descriptor for the specified entity type describing its indexed state.
|
IndexedTypeSet |
getIndexedTypeIdentifiers()
Returns the set of currently indexed types.
|
IndexFamily |
getIndexFamily(IndexFamilyType indexFamilyType)
Get an
IndexFamily using the index family type. |
IndexingMode |
getIndexingMode() |
IndexManager |
getIndexManager(String indexName)
Get an
IndexManager using the name |
IndexReaderAccessor |
getIndexReaderAccessor()
Provides access to the IndexReader API
|
ServiceManager |
getServiceManager()
Returns the service manager.
|
Statistics |
getStatistics()
Retrieve the statistics instance for this factory.
|
Worker |
getWorker()
The Worker is the entry point to apply writes and updates to the indexes.
|
LuceneWorkSerializer |
getWorkSerializer() |
boolean |
isStopped() |
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.
|
IndexedTypeMap<EntityIndexBinding> getIndexBindings()
EntityIndexBinding getIndexBinding(IndexedTypeIdentifier entityType)
entityType
- the type for which to retrieve the bindingnull
is returned for types which are unindexed or
unknown.void addClasses(Class<?>... classes)
classes
- the classes to add to the SearchIntegrator
HSQuery createHSQuery(org.apache.lucene.search.Query fullTextQuery, Class<?>... entityTypes)
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.
fullTextQuery
- the full-text engine queryentityTypes
- the targeted entity typesHSQuery createHSQuery(org.apache.lucene.search.Query fullTextQuery, IndexedTypeMap<CustomTypeMetadata> types)
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.
fullTextQuery
- the full-text engine querytypes
- the targeted entity types, mapped to (potentially null) overridden metadataboolean isStopped()
ErrorHandler getErrorHandler()
TimeoutExceptionFactory getDefaultTimeoutExceptionFactory()
void optimize()
void optimize(IndexedTypeIdentifier entityType)
entityType
entityType
- the entity type (index) to optimizeorg.apache.lucene.analysis.Analyzer getAnalyzer(String name)
name
- the name of the analyzerSearchException
- if the definition name is unknownorg.apache.lucene.analysis.Analyzer getAnalyzer(IndexedTypeIdentifier typeId)
typeId
- The indexed type identifier for which to retrieve the analyzer.IllegalArgumentException
- in case clazz == null
or the specified
class is not an indexed entity.QueryContextBuilder buildQueryBuilder()
Statistics getStatistics()
IndexReaderAccessor getIndexReaderAccessor()
IndexedTypeDescriptor getIndexedTypeDescriptor(IndexedTypeIdentifier typeId)
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.IllegalArgumentException
- in case entityType
is null
IndexedTypeSet getIndexedTypeIdentifiers()
<T> T unwrap(Class<T> cls)
T
- the type of the unwrapped objectcls
- the class of the internal object to unwrapServiceManager getServiceManager()
Worker getWorker()
Worker
void close()
close
in interface AutoCloseable
IndexFamily getIndexFamily(IndexFamilyType indexFamilyType)
IndexFamily
using the index family type.indexFamilyType
- the type of index family to retrieveIndexFamily
, or null if it doesn't existIndexManager getIndexManager(String indexName)
IndexManager
using the nameindexName
- the name of the IndexManager
IndexManager
IndexingMode getIndexingMode()
Environment.INDEXING_STRATEGY
.BatchBackend makeBatchBackend(MassIndexerProgressMonitor progressMonitor)
LuceneWorkSerializer getWorkSerializer()
OperationDispatcher createRemoteOperationDispatcher(Predicate<IndexManager> indexManagerFilter)
indexManagerFilter
- A predicate allowing to exclude index managers from
dispatching. Works will not be applied to these index managers.Copyright © 2006-2023 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.