org.apache.lucene.analysis.miscellaneous

## 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

      public class ProtectedTermFilter
      extends ConditionalTokenFilter

  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

    Constructors
    Constructor and Description
    `ProtectedTermFilter(CharArraySet protectedTerms, TokenStream input, Function<TokenStream,TokenStream> inputFactory)` Creates a new ProtectedTermFilter

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected boolean` | `shouldFilter()` Whether or not to execute the wrapped TokenFilter(s) for the current token

    - ### Methods inherited from class org.apache.lucene.analysis.miscellaneous.ConditionalTokenFilter

      `close, end, incrementToken, reset`

    - ### 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`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### 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 for
        `input` - the input TokenStream
        `inputFactory` - a factory function to create the wrapped filter(s)

  - ### Method Detail

    - #### 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 class `ConditionalTokenFilter`

Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.