org.apache.lucene.index.memory
public class SynonymTokenFilter extends TokenFilter
Modifier and Type | Field and Description |
---|---|
static String |
SYNONYM_TOKEN_TYPE
The Token.type used to indicate a synonym to higher level filters.
|
input
Constructor and Description |
---|
SynonymTokenFilter(TokenStream input,
SynonymMap synonyms,
int maxSynonyms)
Creates an instance for the given underlying stream and synonym table.
|
Modifier and Type | Method and Description |
---|---|
protected Token |
createToken(String synonym,
Token current)
Creates and returns a token for the given synonym of the current input
token; Override for custom (stateless or stateful) behaviour, if desired.
|
Token |
next()
Returns the next token in the stream, or null at EOS.
|
close
next, reset
public static final String SYNONYM_TOKEN_TYPE
public SynonymTokenFilter(TokenStream input, SynonymMap synonyms, int maxSynonyms)
input
- the underlying child token streamsynonyms
- the map used to extract synonyms for termsmaxSynonyms
- the maximum number of synonym tokens to return per underlying
token word (a value of Integer.MAX_VALUE indicates unlimited)public Token next() throws IOException
next
in class TokenStream
IOException
protected Token createToken(String synonym, Token current)
synonym
- a synonym for the current token's termcurrent
- the current token from the underlying child streamCopyright © 2000-2014 Apache Software Foundation. All Rights Reserved.