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.TokenStreamComponentsGLOBAL_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 it's 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)
Retrieves the wrapped Analyzer appropriate for analyzing the field with
the given name
|
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)
Wraps / alters the given TokenStreamComponents, taken from the wrapped
Analyzer, to form new components.
|
createComponents, getOffsetGap, getPositionIncrementGap, initReader, wrapReaderclose, getReuseStrategy, getVersion, setVersion, tokenStream, tokenStreampublic 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)
AnalyzerWrappergetWrappedAnalyzer in class AnalyzerWrapperfieldName - Name of the field which is to be analyzedprotected Analyzer.TokenStreamComponents wrapComponents(String fieldName, Analyzer.TokenStreamComponents components)
AnalyzerWrapperwrapComponents in class AnalyzerWrapperfieldName - Name of the field which is to be analyzedcomponents - TokenStreamComponents taken from the wrapped AnalyzerCopyright © 2000–2015 The Apache Software Foundation. All rights reserved.