public class SynonymTokenFilter extends TokenFilter
AttributeSource.AttributeFactory, AttributeSource.State
Modifier and Type | Field and Description |
---|---|
static java.lang.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 boolean |
createToken(java.lang.String synonym,
AttributeSource.State current)
Creates and returns a token for the given synonym of the current input
token; Override for custom (stateless or stateful) behavior, if desired.
|
boolean |
incrementToken()
Returns the next token in the stream, or null at EOS.
|
void |
reset()
Reset the filter as well as the input TokenStream.
|
close, end
getOnlyUseNewAPI, next, next, setOnlyUseNewAPI
addAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, restoreState, toString
public static final java.lang.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 final boolean incrementToken() throws java.io.IOException
incrementToken
in class TokenStream
Note that this method will be defined abstract in Lucene 3.0.
java.io.IOException
protected boolean createToken(java.lang.String synonym, AttributeSource.State current)
synonym
- a synonym for the current token's termcurrent
- the current token from the underlying child streampublic void reset() throws java.io.IOException
TokenFilter
reset
in class TokenFilter
java.io.IOException
Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.