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
input
Fields inherited from class org.apache.lucene.analysis.TokenStream
DEFAULT_TOKEN_ATTRIBUTE_FACTORY
-
Constructor Summary
ConstructorDescriptionProtectedTermFilter
(CharArraySet protectedTerms, TokenStream input, Function<TokenStream, TokenStream> inputFactory) Creates a new ProtectedTermFilter -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Whether or not to execute the wrapped TokenFilter(s) for the current tokenMethods inherited from class org.apache.lucene.analysis.miscellaneous.ConditionalTokenFilter
close, end, incrementToken, reset
Methods inherited from class org.apache.lucene.analysis.TokenFilter
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
-
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:ConditionalTokenFilter
Whether or not to execute the wrapped TokenFilter(s) for the current token- Specified by:
shouldFilter
in classConditionalTokenFilter
-