Package org.apache.lucene.analysis
Class AnalyzerWrapper
java.lang.Object
org.apache.lucene.analysis.Analyzer
org.apache.lucene.analysis.AnalyzerWrapper
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
LimitTokenCountAnalyzer,PerFieldAnalyzerWrapper,QueryAutoStopWordAnalyzer,ShingleAnalyzerWrapper
Extension to
Analyzer suitable for Analyzers which wrap
other Analyzers.
getWrappedAnalyzer(String) allows the Analyzer
to wrap multiple Analyzers which are selected on a per field basis.
wrapComponents(String, Analyzer.TokenStreamComponents) allows the
TokenStreamComponents of the wrapped Analyzer to then be wrapped
(such as adding a new TokenFilter to form new TokenStreamComponents.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.lucene.analysis.Analyzer
Analyzer.GlobalReuseStrategy, Analyzer.PerFieldReuseStrategy, Analyzer.ReuseStrategy, Analyzer.TokenStreamComponents -
Field Summary
Fields inherited from class org.apache.lucene.analysis.Analyzer
GLOBAL_REUSE_STRATEGY, PER_FIELD_REUSE_STRATEGY -
Method Summary
Modifier and TypeMethodDescriptionintgetOffsetGap(String fieldName) Just likeAnalyzer.getPositionIncrementGap(java.lang.String), except for Token offsets instead.intgetPositionIncrementGap(String fieldName) Invoked before indexing a IndexableField instance if terms have already been added to that field.final ReaderinitReader(String fieldName, Reader reader) Methods inherited from class org.apache.lucene.analysis.Analyzer
close, getReuseStrategy, tokenStream, tokenStream
-
Method Details
-
getPositionIncrementGap
Description copied from class:AnalyzerInvoked before indexing a IndexableField instance if terms have already been added to that field. This allows custom analyzers to place an automatic position increment gap between IndexbleField instances using the same field name. The default value position increment gap is 0. With a 0 position increment gap and the typical default token position increment of 1, all terms in a field, including across IndexableField instances, are in successive positions, allowing exact PhraseQuery matches, for instance, across IndexableField instance boundaries.- Overrides:
getPositionIncrementGapin classAnalyzer- Parameters:
fieldName- IndexableField name being indexed.- Returns:
- position increment gap, added to the next token emitted from
Analyzer.tokenStream(String,Reader). This value must be>= 0.
-
getOffsetGap
Description copied from class:AnalyzerJust likeAnalyzer.getPositionIncrementGap(java.lang.String), except for Token offsets instead. By default this returns 1. This method is only called if the field produced at least one token for indexing.- Overrides:
getOffsetGapin classAnalyzer- Parameters:
fieldName- the field just indexed- Returns:
- offset gap, added to the next token emitted from
Analyzer.tokenStream(String,Reader). This value must be>= 0.
-
initReader
-