Interface LuceneAnalyzerFactory
- All Known Implementing Classes:
EmailCjkSynonymAnalyzerFactory,ExactTokenAnalyzerFactory,LuceneAutoCompleteAnalyzerFactory,NgramAnalyzer.NgramAnalyzerFactory,SynonymAnalyzer.AuthoritativeSynonymOnlyAnalyzerFactory,SynonymAnalyzer.QueryOnlySynonymAnalyzerFactory
public interface LuceneAnalyzerFactory
Each implementation of
Analyzer should have its own implementation
of this factory interface to provide instances of the analyzers for indexing and query to a
LuceneAnalyzerRegistry. The registry will populate a mapping of names to
analyzers using the methods of this interface.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiongetIndexAnalyzerChooser(Index index) Get an instance ofAnalyzerChooserthat chooses the Lucene analyzer based on texts for indexing, given theIndex.getName()Get the unique name for the Lucene analyzer factory.default AnalyzerChoosergetQueryAnalyzerChooser(Index index, AnalyzerChooser indexAnalyzerChooser) Get an instance ofAnalyzerChooserthat chooses the Lucene analyzer for query given theIndex.getType()Get theLuceneAnalyzerTypefor the Lucene analyzer factory.
-
Method Details
-
getName
Get the unique name for the Lucene analyzer factory. This is the name that should be included in the index meta-data in order to indicate that this analyzer factory should be used within a certain index.- Returns:
- the name of the analyzer that this factory creates
-
getType
Get theLuceneAnalyzerTypefor the Lucene analyzer factory.- Returns:
- the
LuceneScanTypesused to determine how the analyzers build by this factory is used
-
getIndexAnalyzerChooser
Get an instance ofAnalyzerChooserthat chooses the Lucene analyzer based on texts for indexing, given theIndex. For a given factory, each indexing analyzer chosen should be of the same type, and it should match the result ofgetName().- Parameters:
index- the index thi analyzer is used for- Returns:
- an instance of the
AnalyzerChooserfor indexing that this factory creates
-
getQueryAnalyzerChooser
@Nonnull default AnalyzerChooser getQueryAnalyzerChooser(@Nonnull Index index, @Nonnull AnalyzerChooser indexAnalyzerChooser) Get an instance ofAnalyzerChooserthat chooses the Lucene analyzer for query given theIndex. For a given factory, each query analyzer chosen should be of the same type, and it should match the result ofgetName(). CallgetIndexAnalyzerChooser(Index)before calling this method, and use its return for the argumentindexAnalyzerChooser. No need to override this method ifStandardAnalyzeris to be used for query time. Override this method to customize the analyzer for query time, or directly return theindexAnalyzerChooserinstance, if it is used for both indexing and query time.- Parameters:
index- the index the analyzer is used forindexAnalyzerChooser- indexAnalyzerChooser the instance ofAnalyzerChooserfor indexing used by this factory, that can be returned by this method in case it is also used for query- Returns:
- an instance of the
AnalyzerChooserfor query that this factory creates, the default one is always usingStandardAnalyzer
-