org.apache.lucene.analysis.custom

## Class CustomAnalyzer.Builder

- java.lang.Object
- - org.apache.lucene.analysis.custom.CustomAnalyzer.Builder

- Enclosing class:
    CustomAnalyzer

      public static final class CustomAnalyzer.Builder
      extends Object

  Builder for `CustomAnalyzer`.
  See Also:
    `CustomAnalyzer.builder()`, `CustomAnalyzer.builder(Path)`, `CustomAnalyzer.builder(ResourceLoader)`

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `CustomAnalyzer.Builder` | `addCharFilter(Class<? extends CharFilterFactory> factory, Map<String,String> params)` Adds the given char filter.
    `CustomAnalyzer.Builder` | `addCharFilter(Class<? extends CharFilterFactory> factory, String... params)` Adds the given char filter.
    `CustomAnalyzer.Builder` | `addCharFilter(String name, Map<String,String> params)` Adds the given char filter.
    `CustomAnalyzer.Builder` | `addCharFilter(String name, String... params)` Adds the given char filter.
    `CustomAnalyzer.Builder` | `addTokenFilter(Class<? extends TokenFilterFactory> factory, Map<String,String> params)` Adds the given token filter.
    `CustomAnalyzer.Builder` | `addTokenFilter(Class<? extends TokenFilterFactory> factory, String... params)` Adds the given token filter.
    `CustomAnalyzer.Builder` | `addTokenFilter(String name, Map<String,String> params)` Adds the given token filter.
    `CustomAnalyzer.Builder` | `addTokenFilter(String name, String... params)` Adds the given token filter.
    `CustomAnalyzer` | `build()` Builds the analyzer.
    `CustomAnalyzer.Builder` | `withDefaultMatchVersion(Version version)` This match version is passed as default to all tokenizers or filters.
    `CustomAnalyzer.Builder` | `withOffsetGap(int offsetGap)` Sets the offset gap of the analyzer.
    `CustomAnalyzer.Builder` | `withPositionIncrementGap(int posIncGap)` Sets the position increment gap of the analyzer.
    `CustomAnalyzer.Builder` | `withTokenizer(Class<? extends TokenizerFactory> factory, Map<String,String> params)` Uses the given tokenizer.
    `CustomAnalyzer.Builder` | `withTokenizer(Class<? extends TokenizerFactory> factory, String... params)` Uses the given tokenizer.
    `CustomAnalyzer.Builder` | `withTokenizer(String name, Map<String,String> params)` Uses the given tokenizer.
    `CustomAnalyzer.Builder` | `withTokenizer(String name, String... params)` Uses the given tokenizer.

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

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

- - ### Method Detail

    - #### withDefaultMatchVersion

          public CustomAnalyzer.Builder withDefaultMatchVersion(Version version)

      This match version is passed as default to all tokenizers or filters. It is used unless you pass the parameter {code luceneMatchVersion} explicitly. It defaults to undefined, so the underlying factory will (in most cases) use `Version.LATEST`.

    - #### withPositionIncrementGap

          public CustomAnalyzer.Builder withPositionIncrementGap(int posIncGap)

      Sets the position increment gap of the analyzer. The default is defined in the analyzer base class.
      See Also:
        `Analyzer.getPositionIncrementGap(String)`

    - #### withOffsetGap

          public CustomAnalyzer.Builder withOffsetGap(int offsetGap)

      Sets the offset gap of the analyzer. The default is defined in the analyzer base class.
      See Also:
        `Analyzer.getOffsetGap(String)`

    - #### withTokenizer

          public CustomAnalyzer.Builder withTokenizer(Class<? extends TokenizerFactory> factory,
                                                      String... params)
                                               throws IOException

      Uses the given tokenizer.
      Parameters:
        `factory` - class that is used to create the tokenizer.
        `params` - a list of factory string params as key/value pairs. The number of parameters must be an even number, as they are pairs.
      Throws:
        `IOException`

    - #### withTokenizer

          public CustomAnalyzer.Builder withTokenizer(Class<? extends TokenizerFactory> factory,
                                                      Map<String,String> params)
                                               throws IOException

      Uses the given tokenizer.
      Parameters:
        `factory` - class that is used to create the tokenizer.
        `params` - the map of parameters to be passed to factory. The map must be modifiable.
      Throws:
        `IOException`

    - #### withTokenizer

          public CustomAnalyzer.Builder withTokenizer(String name,
                                                      String... params)
                                               throws IOException

      Uses the given tokenizer.
      Parameters:
        `name` - is used to look up the factory with `TokenizerFactory.forName(String, Map)`. The list of possible names can be looked up with `TokenizerFactory.availableTokenizers()`.
        `params` - a list of factory string params as key/value pairs. The number of parameters must be an even number, as they are pairs.
      Throws:
        `IOException`

    - #### withTokenizer

          public CustomAnalyzer.Builder withTokenizer(String name,
                                                      Map<String,String> params)
                                               throws IOException

      Uses the given tokenizer.
      Parameters:
        `name` - is used to look up the factory with `TokenizerFactory.forName(String, Map)`. The list of possible names can be looked up with `TokenizerFactory.availableTokenizers()`.
        `params` - the map of parameters to be passed to factory. The map must be modifiable.
      Throws:
        `IOException`

    - #### addTokenFilter

          public CustomAnalyzer.Builder addTokenFilter(Class<? extends TokenFilterFactory> factory,
                                                       String... params)
                                                throws IOException

      Adds the given token filter.
      Parameters:
        `factory` - class that is used to create the token filter.
        `params` - a list of factory string params as key/value pairs. The number of parameters must be an even number, as they are pairs.
      Throws:
        `IOException`

    - #### addTokenFilter

          public CustomAnalyzer.Builder addTokenFilter(Class<? extends TokenFilterFactory> factory,
                                                       Map<String,String> params)
                                                throws IOException

      Adds the given token filter.
      Parameters:
        `factory` - class that is used to create the token filter.
        `params` - the map of parameters to be passed to factory. The map must be modifiable.
      Throws:
        `IOException`

    - #### addTokenFilter

          public CustomAnalyzer.Builder addTokenFilter(String name,
                                                       String... params)
                                                throws IOException

      Adds the given token filter.
      Parameters:
        `name` - is used to look up the factory with `TokenFilterFactory.forName(String, Map)`. The list of possible names can be looked up with `TokenFilterFactory.availableTokenFilters()`.
        `params` - a list of factory string params as key/value pairs. The number of parameters must be an even number, as they are pairs.
      Throws:
        `IOException`

    - #### addTokenFilter

          public CustomAnalyzer.Builder addTokenFilter(String name,
                                                       Map<String,String> params)
                                                throws IOException

      Adds the given token filter.
      Parameters:
        `name` - is used to look up the factory with `TokenFilterFactory.forName(String, Map)`. The list of possible names can be looked up with `TokenFilterFactory.availableTokenFilters()`.
        `params` - the map of parameters to be passed to factory. The map must be modifiable.
      Throws:
        `IOException`

    - #### addCharFilter

          public CustomAnalyzer.Builder addCharFilter(Class<? extends CharFilterFactory> factory,
                                                      String... params)
                                               throws IOException

      Adds the given char filter.
      Parameters:
        `factory` - class that is used to create the char filter.
        `params` - a list of factory string params as key/value pairs. The number of parameters must be an even number, as they are pairs.
      Throws:
        `IOException`

    - #### addCharFilter

          public CustomAnalyzer.Builder addCharFilter(Class<? extends CharFilterFactory> factory,
                                                      Map<String,String> params)
                                               throws IOException

      Adds the given char filter.
      Parameters:
        `factory` - class that is used to create the char filter.
        `params` - the map of parameters to be passed to factory. The map must be modifiable.
      Throws:
        `IOException`

    - #### addCharFilter

          public CustomAnalyzer.Builder addCharFilter(String name,
                                                      String... params)
                                               throws IOException

      Adds the given char filter.
      Parameters:
        `name` - is used to look up the factory with `CharFilterFactory.forName(String, Map)`. The list of possible names can be looked up with `CharFilterFactory.availableCharFilters()`.
        `params` - a list of factory string params as key/value pairs. The number of parameters must be an even number, as they are pairs.
      Throws:
        `IOException`

    - #### addCharFilter

          public CustomAnalyzer.Builder addCharFilter(String name,
                                                      Map<String,String> params)
                                               throws IOException

      Adds the given char filter.
      Parameters:
        `name` - is used to look up the factory with `CharFilterFactory.forName(String, Map)`. The list of possible names can be looked up with `CharFilterFactory.availableCharFilters()`.
        `params` - the map of parameters to be passed to factory. The map must be modifiable.
      Throws:
        `IOException`

    - #### build

          public CustomAnalyzer build()

      Builds the analyzer.

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