public final class CommonGramsQueryFilter extends TokenFilter
AttributeSource.State
Modifier and Type | Field and Description |
---|---|
private boolean |
exhausted |
private PositionIncrementAttribute |
posIncAttribute |
private PositionLengthAttribute |
posLengthAttribute |
private AttributeSource.State |
previous |
private java.lang.String |
previousType |
private TypeAttribute |
typeAttribute |
input
DEFAULT_TOKEN_ATTRIBUTE_FACTORY
Constructor and Description |
---|
CommonGramsQueryFilter(CommonGramsFilter input)
Constructs a new CommonGramsQueryFilter based on the provided CommomGramsFilter
|
Modifier and Type | Method and Description |
---|---|
boolean |
incrementToken()
Output bigrams whenever possible to optimize queries.
|
boolean |
isGramType()
Convenience method to check if the current type is a gram type
|
void |
reset()
This method is called by a consumer before it begins consumption using
TokenStream.incrementToken() . |
close, end
addAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, copyTo, endAttributes, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, reflectAsString, reflectWith, removeAllAttributes, restoreState, toString
private final TypeAttribute typeAttribute
private final PositionIncrementAttribute posIncAttribute
private final PositionLengthAttribute posLengthAttribute
private AttributeSource.State previous
private java.lang.String previousType
private boolean exhausted
public CommonGramsQueryFilter(CommonGramsFilter input)
input
- CommonGramsFilter the QueryFilter will usepublic void reset() throws java.io.IOException
TokenFilter
TokenStream.incrementToken()
.
Resets this stream to a clean state. Stateful implementations must implement this method so that they can be reused, just as if they had been created fresh.
If you override this method, always call super.reset()
, otherwise
some internal state will not be correctly reset (e.g., Tokenizer
will
throw IllegalStateException
on further usage).
NOTE:
The default implementation chains the call to the input TokenStream, so
be sure to call super.reset()
when overriding this method.
reset
in class TokenFilter
java.io.IOException
public boolean incrementToken() throws java.io.IOException
incrementToken
in class TokenStream
java.io.IOException
public boolean isGramType()
true
if the current type is a gram type, false
otherwise