org.apache.lucene.analysis.util

## Class TokenFilterFactory

- java.lang.Object
- - org.apache.lucene.analysis.util.AbstractAnalysisFactory
  - - org.apache.lucene.analysis.util.TokenFilterFactory

- Direct Known Subclasses:
    ApostropheFilterFactory, ArabicNormalizationFilterFactory, ArabicStemFilterFactory, ASCIIFoldingFilterFactory, BengaliNormalizationFilterFactory, BengaliStemFilterFactory, BrazilianStemFilterFactory, BulgarianStemFilterFactory, CapitalizationFilterFactory, CJKBigramFilterFactory, CJKWidthFilterFactory, ClassicFilterFactory, CodepointCountFilterFactory, CommonGramsFilterFactory, ConcatenateGraphFilterFactory, ConditionalTokenFilterFactory, CzechStemFilterFactory, DateRecognizerFilterFactory, DecimalDigitFilterFactory, DelimitedPayloadTokenFilterFactory, DelimitedTermFrequencyTokenFilterFactory, DictionaryCompoundWordTokenFilterFactory, EdgeNGramFilterFactory, ElisionFilterFactory, EnglishMinimalStemFilterFactory, EnglishPossessiveFilterFactory, FingerprintFilterFactory, FinnishLightStemFilterFactory, FixBrokenOffsetsFilterFactory, FixedShingleFilterFactory, FlattenGraphFilterFactory, FrenchLightStemFilterFactory, FrenchMinimalStemFilterFactory, GalicianMinimalStemFilterFactory, GalicianStemFilterFactory, GermanLightStemFilterFactory, GermanMinimalStemFilterFactory, GermanNormalizationFilterFactory, GermanStemFilterFactory, GreekLowerCaseFilterFactory, GreekStemFilterFactory, HindiNormalizationFilterFactory, HindiStemFilterFactory, HungarianLightStemFilterFactory, HunspellStemFilterFactory, HyphenatedWordsFilterFactory, HyphenationCompoundWordTokenFilterFactory, IndicNormalizationFilterFactory, IndonesianStemFilterFactory, IrishLowerCaseFilterFactory, ItalianLightStemFilterFactory, KeepWordFilterFactory, KeywordMarkerFilterFactory, KeywordRepeatFilterFactory, KStemFilterFactory, LatvianStemFilterFactory, LengthFilterFactory, LimitTokenCountFilterFactory, LimitTokenOffsetFilterFactory, LimitTokenPositionFilterFactory, LowerCaseFilterFactory, MinHashFilterFactory, NGramFilterFactory, NorwegianLightStemFilterFactory, NorwegianMinimalStemFilterFactory, NumericPayloadTokenFilterFactory, PatternCaptureGroupFilterFactory, PatternReplaceFilterFactory, PersianNormalizationFilterFactory, PorterStemFilterFactory, PortugueseLightStemFilterFactory, PortugueseMinimalStemFilterFactory, PortugueseStemFilterFactory, RemoveDuplicatesTokenFilterFactory, ReverseStringFilterFactory, RussianLightStemFilterFactory, ScandinavianFoldingFilterFactory, ScandinavianNormalizationFilterFactory, SerbianNormalizationFilterFactory, ShingleFilterFactory, SnowballPorterFilterFactory, SoraniNormalizationFilterFactory, SoraniStemFilterFactory, SpanishLightStemFilterFactory, SpanishMinimalStemFilterFactory, StemmerOverrideFilterFactory, StopFilterFactory, SwedishLightStemFilterFactory, SynonymFilterFactory, SynonymGraphFilterFactory, TokenOffsetPayloadTokenFilterFactory, TrimFilterFactory, TruncateTokenFilterFactory, TurkishLowerCaseFilterFactory, TypeAsPayloadTokenFilterFactory, TypeAsSynonymFilterFactory, TypeTokenFilterFactory, UpperCaseFilterFactory, WordDelimiterFilterFactory, WordDelimiterGraphFilterFactory

      public abstract class TokenFilterFactory
      extends AbstractAnalysisFactory

  Abstract parent class for analysis factories that create `TokenFilter` instances.
  Since:
    3.1

- - ### Field Summary

    - ### Fields inherited from class org.apache.lucene.analysis.util.AbstractAnalysisFactory

      `LUCENE_MATCH_VERSION_PARAM, luceneMatchVersion`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `TokenFilterFactory(Map<String,String> args)` Initialize this factory via a set of key-value pairs.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Set<String>` | `availableTokenFilters()` returns a list of all available tokenfilter names from context classpath
    `abstract TokenStream` | `create(TokenStream input)` Transform the specified input TokenStream
    `static String` | `findSPIName(Class<? extends TokenFilterFactory> serviceClass)` looks up a SPI name for the specified token filter factory
    `static TokenFilterFactory` | `forName(String name, Map<String,String> args)` looks up a tokenfilter by name from context classpath
    `static Class<? extends TokenFilterFactory>` | `lookupClass(String name)` looks up a tokenfilter class by name from context classpath
    `TokenStream` | `normalize(TokenStream input)` Normalize the specified input TokenStream While the default implementation returns input unchanged, filters that should be applied at normalization time can delegate to `create` method.
    `static void` | `reloadTokenFilters(ClassLoader classloader)` Reloads the factory list from the given `ClassLoader`.

    - ### Methods inherited from class org.apache.lucene.analysis.util.AbstractAnalysisFactory

      `get, get, get, get, get, getBoolean, getChar, getClassArg, getFloat, getInt, getLines, getLuceneMatchVersion, getOriginalArgs, getPattern, getSet, getSnowballWordSet, getWordSet, isExplicitLuceneMatchVersion, require, require, require, requireBoolean, requireChar, requireFloat, requireInt, setExplicitLuceneMatchVersion, splitAt, splitFileNames`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TokenFilterFactory

          protected TokenFilterFactory(Map<String,String> args)

      Initialize this factory via a set of key-value pairs.

  - ### Method Detail

    - #### forName

          public static TokenFilterFactory forName(String name,
                                                   Map<String,String> args)

      looks up a tokenfilter by name from context classpath

    - #### lookupClass

          public static Class<? extends TokenFilterFactory> lookupClass(String name)

      looks up a tokenfilter class by name from context classpath

    - #### availableTokenFilters

          public static Set<String> availableTokenFilters()

      returns a list of all available tokenfilter names from context classpath

    - #### findSPIName

          public static String findSPIName(Class<? extends TokenFilterFactory> serviceClass)

      looks up a SPI name for the specified token filter factory

    - #### reloadTokenFilters

          public static void reloadTokenFilters(ClassLoader classloader)

      Reloads the factory list from the given `ClassLoader`. Changes to the factories are visible after the method ends, all iterators (`availableTokenFilters()`,...) stay consistent.

      NOTE: Only new factories are added, existing ones are never removed or replaced.

      This method is expensive and should only be called for discovery of new factories on the given classpath/classloader!

    - #### create

          public abstract TokenStream create(TokenStream input)

      Transform the specified input TokenStream

    - #### normalize

          public TokenStream normalize(TokenStream input)

      Normalize the specified input TokenStream While the default implementation returns input unchanged, filters that should be applied at normalization time can delegate to `create` method.

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