Class LuceneIndexManagerImpl
java.lang.Object
org.hibernate.search.backend.lucene.index.impl.LuceneIndexManagerImpl
- All Implemented Interfaces:
LuceneIndexManager,ReadIndexManagerContext,LuceneScopeIndexManagerContext,LuceneSearchIndexContext,IndexManager,IndexManagerImplementor
public class LuceneIndexManagerImpl
extends Object
implements IndexManagerImplementor, LuceneIndexManager, LuceneScopeIndexManagerContext
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddTo(IndexScopeBuilder builder) List<? extends AnalysisToken>Applies the analyzer to a given string to produce a list of tokens.CompletionStage<List<? extends AnalysisToken>>analyzeAsync(String analyzerName, String terms, OperationSubmitter operationSubmitter) Applies the analyzer to a given string to produce a list of tokens in an async manner.backend()longcomputeSizeInBytesAsync(OperationSubmitter operationSubmitter) createIndexer(BackendSessionContext sessionContext) createIndexingPlan(BackendSessionContext sessionContext, DocumentCommitStrategy commitStrategy, DocumentRefreshStrategy refreshStrategy) createScopeBuilder(BackendMappingContext mappingContext) createWorkspace(BackendMappingContext mappingContext, Set<String> tenantIds) org.apache.lucene.analysis.Analyzermodel()Applies the normalizer to a given string to produce a normalized token.normalizeAsync(String normalizerName, String terms, OperationSubmitter operationSubmitter) Applies the normalizer to a given string to produce a normalized token in an async manner.voidopenIndexReaders(Set<String> routingKeys, DirectoryReaderCollector readerCollector) voidpreStart(IndexManagerStartContext context, SavedState savedState) Starts a subset of resources that are necessary to operate the index manager at runtime, and are expected to be reused upon restarts.preStop()Prepare forIndexManagerImplementor.stop().org.apache.lucene.analysis.Analyzervoidstart(IndexManagerStartContext context) Start any resource necessary to operate the index manager at runtime.voidstop()Stop and release any resource necessary to operate the backend at runtime.toAPI()toString()<T> TUnwrap the index manager to some implementation-specific type.
-
Method Details
-
toString
-
saveForRestart
- Specified by:
saveForRestartin interfaceIndexManagerImplementor
-
preStart
Description copied from interface:IndexManagerImplementorStarts a subset of resources that are necessary to operate the index manager at runtime, and are expected to be reused upon restarts. The resources may be retrieved them from the saved state, or created if they are not present in the saved state.Called by the engine once after bootstrap, after
BackendImplementor.start(BackendStartContext)was called on the corresponding backend.- Specified by:
preStartin interfaceIndexManagerImplementor- Parameters:
context- The start context.savedState- The saved state returned by the corresponding index manager in the Hibernate Search integration being restarted, orSavedState.empty()on the first start.
-
start
Description copied from interface:IndexManagerImplementorStart any resource necessary to operate the index manager at runtime.Called by the engine once just after
IndexManagerImplementor.preStart(IndexManagerStartContext, SavedState).- Specified by:
startin interfaceIndexManagerImplementor- Parameters:
context- The start context.
-
preStop
Description copied from interface:IndexManagerImplementorPrepare forIndexManagerImplementor.stop().- Specified by:
preStopin interfaceIndexManagerImplementor- Returns:
- A future that completes when ongoing works complete.
-
stop
public void stop()Description copied from interface:IndexManagerImplementorStop and release any resource necessary to operate the backend at runtime.Called by the engine once before shutdown.
- Specified by:
stopin interfaceIndexManagerImplementor
-
schemaManager
- Specified by:
schemaManagerin interfaceIndexManagerImplementor
-
createIndexingPlan
public IndexIndexingPlan createIndexingPlan(BackendSessionContext sessionContext, DocumentCommitStrategy commitStrategy, DocumentRefreshStrategy refreshStrategy) - Specified by:
createIndexingPlanin interfaceIndexManagerImplementor
-
createIndexer
- Specified by:
createIndexerin interfaceIndexManagerImplementor
-
createWorkspace
- Specified by:
createWorkspacein interfaceIndexManagerImplementor
-
createScopeBuilder
- Specified by:
createScopeBuilderin interfaceIndexManagerImplementor
-
addTo
- Specified by:
addToin interfaceIndexManagerImplementor
-
openIndexReaders
public void openIndexReaders(Set<String> routingKeys, DirectoryReaderCollector readerCollector) throws IOException - Specified by:
openIndexReadersin interfaceReadIndexManagerContext- Throws:
IOException
-
model
- Specified by:
modelin interfaceLuceneScopeIndexManagerContext
-
identifier
- Specified by:
identifierin interfaceLuceneSearchIndexContext
-
toAPI
- Specified by:
toAPIin interfaceIndexManagerImplementor- Returns:
- The object that should be exposed as API to users.
-
backend
- Specified by:
backendin interfaceIndexManager- Specified by:
backendin interfaceLuceneIndexManager- Returns:
- The backend in which this index manager is defined.
-
descriptor
- Specified by:
descriptorin interfaceIndexManager- Returns:
- A descriptor of this index, exposing in particular a list of field and their characteristics.
-
analyze
Description copied from interface:IndexManagerApplies the analyzer to a given string to produce a list of tokens.- Specified by:
analyzein interfaceIndexManager- Parameters:
analyzerName- The name of the configured analyzer to apply.terms- The string to apply the analysis to.- Returns:
- The list of tokens produced by the analyzer for a given string.
-
normalize
Description copied from interface:IndexManagerApplies the normalizer to a given string to produce a normalized token.- Specified by:
normalizein interfaceIndexManager- Parameters:
normalizerName- The name of the configured normalizer to apply.terms- The string to apply the normalizer to.- Returns:
- The token produced by the normalizer for a given string.
-
analyzeAsync
public CompletionStage<List<? extends AnalysisToken>> analyzeAsync(String analyzerName, String terms, OperationSubmitter operationSubmitter) Description copied from interface:IndexManagerApplies the analyzer to a given string to produce a list of tokens in an async manner.- Specified by:
analyzeAsyncin interfaceIndexManager- Parameters:
analyzerName- The name of the configured analyzer to apply.terms- The string to apply the analysis to.operationSubmitter- How to handle request to submit operation when the queue is full.- Returns:
- A future that will ultimately provide the list of tokens produced by the analyzer for a given string.
-
normalizeAsync
public CompletionStage<AnalysisToken> normalizeAsync(String normalizerName, String terms, OperationSubmitter operationSubmitter) Description copied from interface:IndexManagerApplies the normalizer to a given string to produce a normalized token in an async manner.- Specified by:
normalizeAsyncin interfaceIndexManager- Parameters:
normalizerName- The name of the configured normalizer to apply.terms- The string to apply the normalizer to.operationSubmitter- How to handle request to submit operation when the queue is full.- Returns:
- A future that will ultimately provide the token produced by the normalizer for a given string.
-
indexingAnalyzer
public org.apache.lucene.analysis.Analyzer indexingAnalyzer()- Specified by:
indexingAnalyzerin interfaceLuceneIndexManager- Returns:
- The analyzer used when indexing. This analyzer behaves differently for each field, delegating to the analyzer configured in the mapping.
-
searchAnalyzer
public org.apache.lucene.analysis.Analyzer searchAnalyzer()- Specified by:
searchAnalyzerin interfaceLuceneIndexManager- Returns:
- The analyzer used in search queries. This analyzer behaves differently for each field, delegating to the analyzer configured in the mapping.
-
computeSizeInBytes
public long computeSizeInBytes()- Specified by:
computeSizeInBytesin interfaceLuceneIndexManager- Returns:
- The size of the index on its storage support, in bytes.
-
computeSizeInBytesAsync
- Specified by:
computeSizeInBytesAsyncin interfaceLuceneIndexManager- Returns:
- A future that will ultimately provide the size of the index on its storage support, in bytes.
-
computeSizeInBytesAsync
- Specified by:
computeSizeInBytesAsyncin interfaceLuceneIndexManager- Parameters:
operationSubmitter- How to handle request to submit operation when the queue is full.- Returns:
- A future that will ultimately provide the size of the index on its storage support, in bytes.
-
unwrap
Description copied from interface:IndexManagerUnwrap the index manager to some implementation-specific type.- Specified by:
unwrapin interfaceIndexManager- Type Parameters:
T- The expected type- Parameters:
clazz- TheClassrepresenting the expected type- Returns:
- The unwrapped index manager.
-
getShardsForTests
-