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
FieldsModifier and TypeFieldDescriptionstatic final CharacterRunAutomatonEmpty set of stopwordsstatic final CharacterRunAutomatonSet of common english stopwordsFields inherited from class org.apache.lucene.analysis.TokenFilter
inputFields inherited from class org.apache.lucene.analysis.TokenStream
DEFAULT_TOKEN_ATTRIBUTE_FACTORY -
Constructor Summary
ConstructorsConstructorDescriptionMockTokenFilter(TokenStream input, CharacterRunAutomaton filter) Create a new MockTokenFilter. -
Method Summary
Methods inherited from class org.apache.lucene.analysis.TokenFilter
close, unwrapMethods 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:
incrementTokenin classTokenStream- Throws:
IOException
-
end
- Overrides:
endin classTokenFilter- Throws:
IOException
-
reset
- Overrides:
resetin classTokenFilter- Throws:
IOException
-