public class PrefixAnalyzer
extends org.apache.lucene.analysis.Analyzer
Analyzer
wraps another analyzer and adds a set of prefixes to the
underlying TokenStream. While these prefixes are iterated the position attribute
will not be incremented. Also each prefix will be separated from the other tokens
by a separator character.
NOTE: The sequence of prefixes needs to be not emptyModifier and Type | Class and Description |
---|---|
static class |
PrefixAnalyzer.PrefixTokenFilter
The
PrefixAnalyzer.PrefixTokenFilter wraps a TokenStream and adds a set
prefixes ahead. |
Constructor and Description |
---|
PrefixAnalyzer(org.apache.lucene.analysis.Analyzer analyzer,
char separator,
java.lang.CharSequence prefix)
Create a new
PrefixAnalyzer . |
PrefixAnalyzer(org.apache.lucene.analysis.Analyzer analyzer,
char separator,
java.lang.Iterable<? extends java.lang.CharSequence> prefix)
Create a new
PrefixAnalyzer . |
Modifier and Type | Method and Description |
---|---|
protected org.apache.lucene.analysis.Analyzer.TokenStreamComponents |
createComponents(java.lang.String fieldName) |
public PrefixAnalyzer(org.apache.lucene.analysis.Analyzer analyzer, char separator, java.lang.CharSequence prefix)
PrefixAnalyzer
. The separator will be set to the DEFAULT_SEPARATOR.analyzer
- Analyzer
to wrapprefix
- Single prefixpublic PrefixAnalyzer(org.apache.lucene.analysis.Analyzer analyzer, char separator, java.lang.Iterable<? extends java.lang.CharSequence> prefix)
PrefixAnalyzer
. The separator will be set to the DEFAULT_SEPARATOR.analyzer
- Analyzer
to wrapprefix
- Iterable
of CharSequence
which keeps all prefixes