Package org.apache.lucene.tests.analysis
Class MockTokenFilter
java.lang.Object
org.apache.lucene.util.AttributeSource
org.apache.lucene.analysis.TokenStream
org.apache.lucene.analysis.TokenFilter
org.apache.lucene.tests.analysis.MockTokenFilter
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Unwrappable<TokenStream>
A tokenfilter for testing that removes terms accepted by a DFA.
- Union a list of singletons to act like a stopfilter.
- Use the complement to act like a keepwordfilter
- Use a regex like
.{12,}
to act like a lengthfilter
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.lucene.util.AttributeSource
AttributeSource.State
-
Field Summary
Modifier and TypeFieldDescriptionstatic final CharacterRunAutomaton
Empty set of stopwordsstatic final CharacterRunAutomaton
Set of common english stopwordsFields inherited from class org.apache.lucene.analysis.TokenFilter
input
Fields inherited from class org.apache.lucene.analysis.TokenStream
DEFAULT_TOKEN_ATTRIBUTE_FACTORY
-
Constructor Summary
ConstructorDescriptionMockTokenFilter
(TokenStream input, CharacterRunAutomaton filter) Create a new MockTokenFilter. -
Method Summary
Methods inherited from class org.apache.lucene.analysis.TokenFilter
close, 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
-
Field Details
-
EMPTY_STOPSET
Empty set of stopwords -
ENGLISH_STOPSET
Set of common english stopwords
-
-
Constructor Details
-
MockTokenFilter
Create a new MockTokenFilter.- Parameters:
input
- TokenStream to filterfilter
- DFA representing the terms that should be removed.
-
-
Method Details
-
incrementToken
- Specified by:
incrementToken
in classTokenStream
- Throws:
IOException
-
end
- Overrides:
end
in classTokenFilter
- Throws:
IOException
-
reset
- Overrides:
reset
in classTokenFilter
- Throws:
IOException
-