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,
CharSequence prefix)
Create a new
PrefixAnalyzer . |
PrefixAnalyzer(org.apache.lucene.analysis.Analyzer analyzer,
char separator,
Iterable<? extends CharSequence> prefix)
Create a new
PrefixAnalyzer . |
Modifier and Type | Method and Description |
---|---|
protected org.apache.lucene.analysis.Analyzer.TokenStreamComponents |
createComponents(String fieldName) |
public PrefixAnalyzer(org.apache.lucene.analysis.Analyzer analyzer, char separator, CharSequence prefix)
PrefixAnalyzer
.analyzer
- Analyzer
to wrapseparator
- Separator between each prefix and the other tokensprefix
- Single prefixpublic PrefixAnalyzer(org.apache.lucene.analysis.Analyzer analyzer, char separator, Iterable<? extends CharSequence> prefix)
PrefixAnalyzer
.analyzer
- Analyzer
to wrapseparator
- Separator between each prefix and the other tokensprefix
- Iterable
of CharSequence
which keeps all prefixesprotected org.apache.lucene.analysis.Analyzer.TokenStreamComponents createComponents(String fieldName)
createComponents
in class org.apache.lucene.analysis.Analyzer
Copyright © 2009–2017. All rights reserved.