public abstract class ConditionalTokenFilter extends TokenFilter
shouldFilter()
method. If it returns true
,
then calling incrementToken()
will use the wrapped TokenFilter(s) to
make changes to the tokenstream. If it returns false
, then the wrapped
filter(s) will be skipped.AttributeSource.State
input
DEFAULT_TOKEN_ATTRIBUTE_FACTORY
Modifier | Constructor and Description |
---|---|
protected |
ConditionalTokenFilter(TokenStream input,
Function<TokenStream,TokenStream> inputFactory)
Create a new ConditionalTokenFilter
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
end() |
boolean |
incrementToken() |
void |
reset() |
protected abstract boolean |
shouldFilter()
Whether or not to execute the wrapped TokenFilter(s) for the current token
|
addAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, copyTo, endAttributes, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, reflectAsString, reflectWith, removeAllAttributes, restoreState, toString
protected ConditionalTokenFilter(TokenStream input, Function<TokenStream,TokenStream> inputFactory)
input
- the input TokenStreaminputFactory
- a factory function to create the wrapped filter(s)protected abstract boolean shouldFilter() throws IOException
IOException
public void reset() throws IOException
reset
in class TokenFilter
IOException
public void end() throws IOException
end
in class TokenFilter
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class TokenFilter
IOException
public final boolean incrementToken() throws IOException
incrementToken
in class TokenStream
IOException
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.