public class SynonymTokenFilter
extends org.apache.lucene.analysis.TokenFilter
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.
|
Constructor and Description |
---|
SynonymTokenFilter(org.apache.lucene.analysis.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,
org.apache.lucene.util.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() |
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(org.apache.lucene.analysis.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 org.apache.lucene.analysis.TokenStream
java.io.IOException
protected boolean createToken(java.lang.String synonym, org.apache.lucene.util.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
reset
in class org.apache.lucene.analysis.TokenFilter
java.io.IOException
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.