org.apache.lucene.analysis.util

## Class CharFilterFactory

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

- Direct Known Subclasses:
    CJKWidthCharFilterFactory, HTMLStripCharFilterFactory, MappingCharFilterFactory, PatternReplaceCharFilterFactory, PersianCharFilterFactory

      public abstract class CharFilterFactory
      extends AbstractAnalysisFactory

  Abstract parent class for analysis factories that create `CharFilter` 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` | `CharFilterFactory(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>` | `availableCharFilters()` returns a list of all available charfilter names
    `abstract Reader` | `create(Reader input)` Wraps the given Reader with a CharFilter.
    `static String` | `findSPIName(Class<? extends CharFilterFactory> serviceClass)` looks up a SPI name for the specified char filter factory
    `static CharFilterFactory` | `forName(String name, Map<String,String> args)` looks up a charfilter by name from context classpath
    `static Class<? extends CharFilterFactory>` | `lookupClass(String name)` looks up a charfilter class by name from context classpath
    `Reader` | `normalize(Reader input)` Normalize the specified input Reader While the default implementation returns input unchanged, char filters that should be applied at normalization time can delegate to `create` method.
    `static void` | `reloadCharFilters(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

    - #### CharFilterFactory

          protected CharFilterFactory(Map<String,String> args)

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

  - ### Method Detail

    - #### forName

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

      looks up a charfilter by name from context classpath

    - #### lookupClass

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

      looks up a charfilter class by name from context classpath

    - #### availableCharFilters

          public static Set<String> availableCharFilters()

      returns a list of all available charfilter names

    - #### findSPIName

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

      looks up a SPI name for the specified char filter factory

    - #### reloadCharFilters

          public static void reloadCharFilters(ClassLoader classloader)

      Reloads the factory list from the given `ClassLoader`. Changes to the factories are visible after the method ends, all iterators (`availableCharFilters()`,...) 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 Reader create(Reader input)

      Wraps the given Reader with a CharFilter.

    - #### normalize

          public Reader normalize(Reader input)

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

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