public final class LengthFilter extends FilteringTokenFilter
Note: Length is calculated as the number of UTF-16 code units.
AttributeSource.State
input
DEFAULT_TOKEN_ATTRIBUTE_FACTORY
Constructor and Description |
---|
LengthFilter(TokenStream in,
int min,
int max)
Create a new
LengthFilter . |
Modifier and Type | Method and Description |
---|---|
boolean |
accept() |
end, incrementToken, reset
close
addAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, copyTo, endAttributes, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, reflectAsString, reflectWith, removeAllAttributes, restoreState, toString
public LengthFilter(TokenStream in, int min, int max)
LengthFilter
. This will filter out tokens whose
CharTermAttribute
is either too short (CharSequence.length()
< min) or too long (CharSequence.length()
> max).in
- the TokenStream
to consumemin
- the minimum lengthmax
- the maximum lengthpublic boolean accept()
accept
in class FilteringTokenFilter
Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.