org.apache.lucene.analysis

## Class StopAnalyzer

- java.lang.Object
- - org.apache.lucene.analysis.Analyzer
  - - org.apache.lucene.analysis.StopAnalyzer

-     public final class StopAnalyzer
      extends Analyzer

  Filters `LetterTokenizer` with `LowerCaseFilter` and `StopFilter`.

  You must specify the required `Version` compatibility when creating StopAnalyzer:

  - As of 2.9, position increments are preserved

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String[]` | `ENGLISH_STOP_WORDS` Deprecated. Use `ENGLISH_STOP_WORDS_SET` instead
    `static java.util.Set` | `ENGLISH_STOP_WORDS_SET` An unmodifiable set containing some common English words that are not usually useful for searching.

    - ### Fields inherited from class org.apache.lucene.analysis.Analyzer

      `overridesTokenStreamMethod`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StopAnalyzer()` Deprecated. Use `StopAnalyzer(Version)` instead
    `StopAnalyzer(boolean enablePositionIncrements)` Deprecated. Use `StopAnalyzer(Version)` instead
    `StopAnalyzer(java.io.File stopwordsFile)` Deprecated. Use `StopAnalyzer(Version, File)` instead
    `StopAnalyzer(java.io.File stopwordsFile, boolean enablePositionIncrements)` Deprecated. Use `StopAnalyzer(Version, File)` instead
    `StopAnalyzer(java.io.Reader stopwords)` Deprecated. Use `StopAnalyzer(Version, Reader)` instead
    `StopAnalyzer(java.io.Reader stopwords, boolean enablePositionIncrements)` Deprecated. Use `StopAnalyzer(Version, Reader)` instead
    `StopAnalyzer(java.util.Set stopWords)` Deprecated. Use `StopAnalyzer(Version, Set)` instead
    `StopAnalyzer(java.util.Set stopWords, boolean enablePositionIncrements)` Deprecated. Use `StopAnalyzer(Version, Set)` instead
    `StopAnalyzer(java.lang.String[] stopWords)` Deprecated. Use `StopAnalyzer(Version, Set)` instead
    `StopAnalyzer(java.lang.String[] stopWords, boolean enablePositionIncrements)` Deprecated. Use `StopAnalyzer(Version, Set)` instead
    `StopAnalyzer(Version matchVersion)` Builds an analyzer which removes words in ENGLISH_STOP_WORDS.
    `StopAnalyzer(Version matchVersion, java.io.File stopwordsFile)` Builds an analyzer with the stop words from the given file.
    `StopAnalyzer(Version matchVersion, java.io.Reader stopwords)` Builds an analyzer with the stop words from the given reader.
    `StopAnalyzer(Version matchVersion, java.util.Set stopWords)` Builds an analyzer with the stop words from the given set.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `TokenStream` | `reusableTokenStream(java.lang.String fieldName, java.io.Reader reader)` Creates a TokenStream that is allowed to be re-used from the previous time that the same thread called this method.
    `TokenStream` | `tokenStream(java.lang.String fieldName, java.io.Reader reader)` Filters LowerCaseTokenizer with StopFilter.

    - ### Methods inherited from class org.apache.lucene.analysis.Analyzer

      `close, getOffsetGap, getPositionIncrementGap, getPreviousTokenStream, setOverridesTokenStreamMethod, setPreviousTokenStream`

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

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

- - ### Field Detail

    - #### ENGLISH_STOP_WORDS

          public static final java.lang.String[] ENGLISH_STOP_WORDS

      Deprecated. Use `ENGLISH_STOP_WORDS_SET` instead
      An array containing some common English words that are not usually useful for searching.

    - #### ENGLISH_STOP_WORDS_SET

          public static final java.util.Set ENGLISH_STOP_WORDS_SET

      An unmodifiable set containing some common English words that are not usually useful for searching.

  - ### Constructor Detail

    - #### StopAnalyzer

          public StopAnalyzer()

      Deprecated. Use `StopAnalyzer(Version)` instead
      Builds an analyzer which removes words in ENGLISH_STOP_WORDS.

    - #### StopAnalyzer

          public StopAnalyzer(Version matchVersion)

      Builds an analyzer which removes words in ENGLISH_STOP_WORDS.

    - #### StopAnalyzer

          public StopAnalyzer(boolean enablePositionIncrements)

      Deprecated. Use `StopAnalyzer(Version)` instead
      Builds an analyzer which removes words in ENGLISH_STOP_WORDS.
      Parameters:
        `enablePositionIncrements` - See `StopFilter.setEnablePositionIncrements(boolean)`

    - #### StopAnalyzer

          public StopAnalyzer(java.util.Set stopWords)

      Deprecated. Use `StopAnalyzer(Version, Set)` instead
      Builds an analyzer with the stop words from the given set.

    - #### StopAnalyzer

          public StopAnalyzer(Version matchVersion,
                              java.util.Set stopWords)

      Builds an analyzer with the stop words from the given set.

    - #### StopAnalyzer

          public StopAnalyzer(java.util.Set stopWords,
                              boolean enablePositionIncrements)

      Deprecated. Use `StopAnalyzer(Version, Set)` instead
      Builds an analyzer with the stop words from the given set.
      Parameters:
        `stopWords` - Set of stop words
        `enablePositionIncrements` - See `StopFilter.setEnablePositionIncrements(boolean)`

    - #### StopAnalyzer

          public StopAnalyzer(java.lang.String[] stopWords)

      Deprecated. Use `StopAnalyzer(Version, Set)` instead
      Builds an analyzer which removes words in the provided array.

    - #### StopAnalyzer

          public StopAnalyzer(java.lang.String[] stopWords,
                              boolean enablePositionIncrements)

      Deprecated. Use `StopAnalyzer(Version, Set)` instead
      Builds an analyzer which removes words in the provided array.
      Parameters:
        `stopWords` - Array of stop words
        `enablePositionIncrements` - See `StopFilter.setEnablePositionIncrements(boolean)`

    - #### StopAnalyzer

          public StopAnalyzer(java.io.File stopwordsFile)
                       throws java.io.IOException

      Deprecated. Use `StopAnalyzer(Version, File)` instead
      Builds an analyzer with the stop words from the given file.
      Throws:
        `java.io.IOException`
      See Also:
        `WordlistLoader.getWordSet(File)`

    - #### StopAnalyzer

          public StopAnalyzer(java.io.File stopwordsFile,
                              boolean enablePositionIncrements)
                       throws java.io.IOException

      Deprecated. Use `StopAnalyzer(Version, File)` instead
      Builds an analyzer with the stop words from the given file.
      Parameters:
        `stopwordsFile` - File to load stop words from
        `enablePositionIncrements` - See `StopFilter.setEnablePositionIncrements(boolean)`
      Throws:
        `java.io.IOException`
      See Also:
        `WordlistLoader.getWordSet(File)`

    - #### StopAnalyzer

          public StopAnalyzer(Version matchVersion,
                              java.io.File stopwordsFile)
                       throws java.io.IOException

      Builds an analyzer with the stop words from the given file.
      Parameters:
        `matchVersion` - See above
        `stopwordsFile` - File to load stop words from
      Throws:
        `java.io.IOException`
      See Also:
        `WordlistLoader.getWordSet(File)`

    - #### StopAnalyzer

          public StopAnalyzer(java.io.Reader stopwords)
                       throws java.io.IOException

      Deprecated. Use `StopAnalyzer(Version, Reader)` instead
      Builds an analyzer with the stop words from the given reader.
      Throws:
        `java.io.IOException`
      See Also:
        `WordlistLoader.getWordSet(Reader)`

    - #### StopAnalyzer

          public StopAnalyzer(java.io.Reader stopwords,
                              boolean enablePositionIncrements)
                       throws java.io.IOException

      Deprecated. Use `StopAnalyzer(Version, Reader)` instead
      Builds an analyzer with the stop words from the given reader.
      Parameters:
        `stopwords` - Reader to load stop words from
        `enablePositionIncrements` - See `StopFilter.setEnablePositionIncrements(boolean)`
      Throws:
        `java.io.IOException`
      See Also:
        `WordlistLoader.getWordSet(Reader)`

    - #### StopAnalyzer

          public StopAnalyzer(Version matchVersion,
                              java.io.Reader stopwords)
                       throws java.io.IOException

      Builds an analyzer with the stop words from the given reader.
      Parameters:
        `matchVersion` - See above
        `stopwords` - Reader to load stop words from
      Throws:
        `java.io.IOException`
      See Also:
        `WordlistLoader.getWordSet(Reader)`

  - ### Method Detail

    - #### tokenStream

          public TokenStream tokenStream(java.lang.String fieldName,
                                         java.io.Reader reader)

      Filters LowerCaseTokenizer with StopFilter.
      Specified by:
        `tokenStream` in class `Analyzer`

    - #### reusableTokenStream

          public TokenStream reusableTokenStream(java.lang.String fieldName,
                                                 java.io.Reader reader)
                                          throws java.io.IOException

      Description copied from class: `Analyzer`
      Creates a TokenStream that is allowed to be re-used from the previous time that the same thread called this method. Callers that do not need to use more than one TokenStream at the same time from this analyzer should use this method for better performance.
      Overrides:
        `reusableTokenStream` in class `Analyzer`
      Throws:
        `java.io.IOException`

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