Class ProtectedTermFilter
java.lang.Object
org.apache.lucene.util.AttributeSource
org.apache.lucene.analysis.TokenStream
org.apache.lucene.analysis.TokenFilter
org.apache.lucene.analysis.miscellaneous.ConditionalTokenFilter
org.apache.lucene.analysis.miscellaneous.ProtectedTermFilter
- All Implemented Interfaces:
Closeable,AutoCloseable,Unwrappable<TokenStream>
A ConditionalTokenFilter that only applies its wrapped filters to tokens that are not contained
in a protected set.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.lucene.util.AttributeSource
AttributeSource.State -
Field Summary
Fields inherited from class org.apache.lucene.analysis.TokenFilter
inputFields inherited from class org.apache.lucene.analysis.TokenStream
DEFAULT_TOKEN_ATTRIBUTE_FACTORY -
Constructor Summary
ConstructorsConstructorDescriptionProtectedTermFilter(CharArraySet protectedTerms, TokenStream input, Function<TokenStream, TokenStream> inputFactory) Creates a new ProtectedTermFilter -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanWhether or not to execute the wrapped TokenFilter(s) for the current tokenMethods inherited from class org.apache.lucene.analysis.miscellaneous.ConditionalTokenFilter
close, end, incrementToken, resetMethods inherited from class org.apache.lucene.analysis.TokenFilter
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
-
Constructor Details
-
ProtectedTermFilter
public ProtectedTermFilter(CharArraySet protectedTerms, TokenStream input, Function<TokenStream, TokenStream> inputFactory) Creates a new ProtectedTermFilter- Parameters:
protectedTerms- the set of terms to skip the wrapped filters forinput- the input TokenStreaminputFactory- a factory function to create the wrapped filter(s)
-
-
Method Details
-
shouldFilter
protected boolean shouldFilter()Description copied from class:ConditionalTokenFilterWhether or not to execute the wrapped TokenFilter(s) for the current token- Specified by:
shouldFilterin classConditionalTokenFilter
-