Overview | Package | Class | Use | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.lucene.analysis.util
Class StopwordAnalyzerBase

    java.lang.Object
      org.apache.lucene.analysis.Analyzer
          org.apache.lucene.analysis.util.StopwordAnalyzerBase

All Implemented Interfaces:
  Closeable

Direct Known Subclasses:
  ArabicAnalyzer, ArmenianAnalyzer, BasqueAnalyzer, BrazilianAnalyzer, BulgarianAnalyzer, CatalanAnalyzer, CJKAnalyzer, ClassicAnalyzer, CzechAnalyzer, DanishAnalyzer, EnglishAnalyzer, FinnishAnalyzer, FrenchAnalyzer, GalicianAnalyzer, GermanAnalyzer, GreekAnalyzer, HindiAnalyzer, HungarianAnalyzer, IndonesianAnalyzer, IrishAnalyzer, ItalianAnalyzer, LatvianAnalyzer, NorwegianAnalyzer, PersianAnalyzer, PortugueseAnalyzer, RomanianAnalyzer, RussianAnalyzer, SpanishAnalyzer, StandardAnalyzer, StopAnalyzer, SwedishAnalyzer, ThaiAnalyzer, TurkishAnalyzer, UAX29URLEmailAnalyzer

    public abstract class StopwordAnalyzerBase

extends Analyzer

Base class for Analyzers that need to make use of stopword sets.

Nested Class Summary

Nested classes/interfaces inherited from class org.apache.lucene.analysis.Analyzer
`Analyzer.GlobalReuseStrategy, Analyzer.PerFieldReuseStrategy, Analyzer.ReuseStrategy, Analyzer.TokenStreamComponents`

Field Summary
`protected Version` | `matchVersion`
`protected CharArraySet` | `stopwords` An immutable stopword set

Constructor Summary
`protected` | `StopwordAnalyzerBase(Version version)` Creates a new Analyzer with an empty stopword set
`protected` | `StopwordAnalyzerBase(Version version, CharArraySet stopwords)` Creates a new instance initialized with the given stopword set

Method Summary
`CharArraySet` | `getStopwordSet()` Returns the analyzer's stopword set or an empty set if the analyzer has no stopwords
`protected static CharArraySet` | `loadStopwordSet(boolean ignoreCase, Class<? extends Analyzer> aClass, String resource, String comment)` Creates a CharArraySet from a file resource associated with a class.
`protected static CharArraySet` | `loadStopwordSet(File stopwords, Version matchVersion)` Creates a CharArraySet from a file.
`protected static CharArraySet` | `loadStopwordSet(Reader stopwords, Version matchVersion)` Creates a CharArraySet from a file.

Methods inherited from class org.apache.lucene.analysis.Analyzer
`close, createComponents, getOffsetGap, getPositionIncrementGap, initReader, tokenStream`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### stopwords

    protected final CharArraySet stopwords

  An immutable stopword set

### matchVersion

    protected final Version matchVersion

Constructor Detail

### StopwordAnalyzerBase

    protected StopwordAnalyzerBase(Version version,
                                   CharArraySet stopwords)

  Creates a new instance initialized with the given stopword set

  Parameters:
    `version` - the Lucene version for cross version compatibility
    `stopwords` - the analyzer's stopword set

### StopwordAnalyzerBase

    protected StopwordAnalyzerBase(Version version)

  Creates a new Analyzer with an empty stopword set

  Parameters:
    `version` - the Lucene version for cross version compatibility

Method Detail

### getStopwordSet

    public CharArraySet getStopwordSet()

  Returns the analyzer's stopword set or an empty set if the analyzer has no stopwords

  Returns:
    the analyzer's stopword set or an empty set if the analyzer has no stopwords

### loadStopwordSet

    protected static CharArraySet loadStopwordSet(boolean ignoreCase,
                                                  Class<? extends Analyzer> aClass,
                                                  String resource,
                                                  String comment)
                                           throws IOException

  Creates a CharArraySet from a file resource associated with a class. (See `Class.getResourceAsStream(String)`).

  Parameters:
    `ignoreCase` - `true` if the set should ignore the case of the stopwords, otherwise `false`
    `aClass` - a class that is associated with the given stopwordResource
    `resource` - name of the resource file associated with the given class
    `comment` - comment string to ignore in the stopword file
  Returns:
    a CharArraySet containing the distinct stopwords from the given file
  Throws:
    `IOException` - if loading the stopwords throws an `IOException`

### loadStopwordSet

    protected static CharArraySet loadStopwordSet(File stopwords,
                                                  Version matchVersion)
                                           throws IOException

  Creates a CharArraySet from a file.

  Parameters:
    `stopwords` - the stopwords file to load
    `matchVersion` - the Lucene version for cross version compatibility
  Returns:
    a CharArraySet containing the distinct stopwords from the given file
  Throws:
    `IOException` - if loading the stopwords throws an `IOException`

### loadStopwordSet

    protected static CharArraySet loadStopwordSet(Reader stopwords,
                                                  Version matchVersion)
                                           throws IOException

  Creates a CharArraySet from a file.

  Parameters:
    `stopwords` - the stopwords reader to load
    `matchVersion` - the Lucene version for cross version compatibility
  Returns:
    a CharArraySet containing the distinct stopwords from the given reader
  Throws:
    `IOException` - if loading the stopwords throws an `IOException`

Overview | Package | Class | Use | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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