public final class LimitTokenOffsetFilter extends TokenFilter
By default, this filter ignores any tokens in the wrapped TokenStream
once the limit has been exceeded, which can result in reset()
being
called prior to incrementToken()
returning false
. For most
TokenStream
implementations this should be acceptable, and faster
then consuming the full stream. If you are wrapping a TokenStream
which requires that the full stream of tokens be exhausted in order to
function properly, use the
LimitTokenOffsetFilter(TokenStream, int, boolean)
option.
AttributeSource.State
input
DEFAULT_TOKEN_ATTRIBUTE_FACTORY
Constructor and Description |
---|
LimitTokenOffsetFilter(TokenStream input,
int maxStartOffset)
Lets all tokens pass through until it sees one with a start offset <=
maxStartOffset
which won't pass and ends the stream. |
LimitTokenOffsetFilter(TokenStream input,
int maxStartOffset,
boolean consumeAllTokens) |
Modifier and Type | Method and Description |
---|---|
boolean |
incrementToken() |
close, end, reset
addAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, copyTo, endAttributes, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, reflectAsString, reflectWith, removeAllAttributes, restoreState, toString
public LimitTokenOffsetFilter(TokenStream input, int maxStartOffset)
maxStartOffset
which won't pass and ends the stream. It won't consume any tokens afterwards.maxStartOffset
- the maximum start offset allowedpublic LimitTokenOffsetFilter(TokenStream input, int maxStartOffset, boolean consumeAllTokens)
public boolean incrementToken() throws IOException
incrementToken
in class TokenStream
IOException
Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.