public final class CompletionAnalyzer extends AnalyzerWrapper
Analyzer
to provide additional completion-only tuning
(e.g. preserving token separators, preserving position increments while converting
a token stream to an automaton)
Can be used to index SuggestField
and ContextSuggestField
and as a query analyzer to PrefixCompletionQuery
amd FuzzyCompletionQuery
NOTE: In most cases, index and query analyzer should have same values for preservePositionIncrements()
and preserveSep()
Analyzer.ReuseStrategy, Analyzer.TokenStreamComponents
GLOBAL_REUSE_STRATEGY, PER_FIELD_REUSE_STRATEGY
Constructor and Description |
---|
CompletionAnalyzer(Analyzer analyzer)
Calls
CompletionAnalyzer(org.apache.lucene.analysis.Analyzer, boolean, boolean, int)
preserving token separation, position increments and no limit on graph expansions |
CompletionAnalyzer(Analyzer analyzer,
boolean preserveSep,
boolean preservePositionIncrements)
Calls
CompletionAnalyzer(org.apache.lucene.analysis.Analyzer, boolean, boolean, int)
with no limit on graph expansions |
CompletionAnalyzer(Analyzer analyzer,
boolean preserveSep,
boolean preservePositionIncrements,
int maxGraphExpansions)
Wraps an analyzer to convert its output token stream to an automaton
|
CompletionAnalyzer(Analyzer analyzer,
int maxGraphExpansions)
Calls
CompletionAnalyzer(org.apache.lucene.analysis.Analyzer, boolean, boolean, int)
preserving token separation and position increments |
Modifier and Type | Method and Description |
---|---|
protected Analyzer |
getWrappedAnalyzer(String fieldName) |
boolean |
preservePositionIncrements()
Returns true if position increments are preserved when converting
the token stream to an automaton
|
boolean |
preserveSep()
Returns true if separation between tokens are preserved when converting
the token stream to an automaton
|
protected Analyzer.TokenStreamComponents |
wrapComponents(String fieldName,
Analyzer.TokenStreamComponents components) |
attributeFactory, createComponents, getOffsetGap, getPositionIncrementGap, initReader, initReaderForNormalization, normalize, wrapReader, wrapReaderForNormalization, wrapTokenStreamForNormalization
close, getReuseStrategy, getVersion, normalize, setVersion, tokenStream, tokenStream
public CompletionAnalyzer(Analyzer analyzer, boolean preserveSep, boolean preservePositionIncrements, int maxGraphExpansions)
analyzer
- token stream to be converted to an automatonpreserveSep
- Preserve separation between tokens when converting to an automatonpreservePositionIncrements
- Preserve position increments for tokens when converting to an automatonmaxGraphExpansions
- Sets the maximum number of graph expansions of a completion automatonpublic CompletionAnalyzer(Analyzer analyzer)
CompletionAnalyzer(org.apache.lucene.analysis.Analyzer, boolean, boolean, int)
preserving token separation, position increments and no limit on graph expansionspublic CompletionAnalyzer(Analyzer analyzer, boolean preserveSep, boolean preservePositionIncrements)
CompletionAnalyzer(org.apache.lucene.analysis.Analyzer, boolean, boolean, int)
with no limit on graph expansionspublic CompletionAnalyzer(Analyzer analyzer, int maxGraphExpansions)
CompletionAnalyzer(org.apache.lucene.analysis.Analyzer, boolean, boolean, int)
preserving token separation and position incrementspublic boolean preserveSep()
public boolean preservePositionIncrements()
protected Analyzer getWrappedAnalyzer(String fieldName)
getWrappedAnalyzer
in class AnalyzerWrapper
protected Analyzer.TokenStreamComponents wrapComponents(String fieldName, Analyzer.TokenStreamComponents components)
wrapComponents
in class AnalyzerWrapper
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.