Package org.apache.lucene.tests.analysis
Class MockGraphTokenFilter
java.lang.Object
org.apache.lucene.util.AttributeSource
org.apache.lucene.analysis.TokenStream
org.apache.lucene.analysis.TokenFilter
org.apache.lucene.tests.analysis.LookaheadTokenFilter<LookaheadTokenFilter.Position>
org.apache.lucene.tests.analysis.MockGraphTokenFilter
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Unwrappable<TokenStream>
Randomly inserts overlapped (posInc=0) tokens with posLength sometimes > 1. The chain must
have an OffsetAttribute.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.lucene.tests.analysis.LookaheadTokenFilter
LookaheadTokenFilter.Position
Nested classes/interfaces inherited from class org.apache.lucene.util.AttributeSource
AttributeSource.State
-
Field Summary
Fields inherited from class org.apache.lucene.tests.analysis.LookaheadTokenFilter
end, inputPos, offsetAtt, outputPos, posIncAtt, positions, posLenAtt
Fields inherited from class org.apache.lucene.analysis.TokenFilter
input
Fields inherited from class org.apache.lucene.analysis.TokenStream
DEFAULT_TOKEN_ATTRIBUTE_FACTORY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
This is called when all input tokens leaving a given position have been returned.void
close()
boolean
protected LookaheadTokenFilter.Position
void
reset()
Methods inherited from class org.apache.lucene.tests.analysis.LookaheadTokenFilter
insertToken, nextToken, peekToken
Methods inherited from class org.apache.lucene.analysis.TokenFilter
end, unwrap
Methods inherited from class org.apache.lucene.util.AttributeSource
addAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, copyTo, endAttributes, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, reflectAsString, reflectWith, removeAllAttributes, restoreState, toString
-
Constructor Details
-
MockGraphTokenFilter
-
-
Method Details
-
newPosition
- Specified by:
newPosition
in classLookaheadTokenFilter<LookaheadTokenFilter.Position>
-
afterPosition
Description copied from class:LookaheadTokenFilter
This is called when all input tokens leaving a given position have been returned. Override this and call insertToken and then set whichever token's attributes you want, if you want to inject a token starting from this position.- Overrides:
afterPosition
in classLookaheadTokenFilter<LookaheadTokenFilter.Position>
- Throws:
IOException
-
reset
- Overrides:
reset
in classLookaheadTokenFilter<LookaheadTokenFilter.Position>
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classTokenFilter
- Throws:
IOException
-
incrementToken
- Specified by:
incrementToken
in classTokenStream
- Throws:
IOException
-