org.apache.lucene.analysis
Class StopAnalyzer

java.lang.Object
  extended by org.apache.lucene.analysis.Analyzer
      extended by 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:


Field Summary
static String[] ENGLISH_STOP_WORDS
          Deprecated. Use ENGLISH_STOP_WORDS_SET instead
static 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
StopAnalyzer()
          Deprecated. Use StopAnalyzer(Version) instead
StopAnalyzer(boolean enablePositionIncrements)
          Deprecated. Use StopAnalyzer(Version) instead
StopAnalyzer(File stopwordsFile)
          Deprecated. Use StopAnalyzer(Version, File) instead
StopAnalyzer(File stopwordsFile, boolean enablePositionIncrements)
          Deprecated. Use StopAnalyzer(Version, File) instead
StopAnalyzer(Reader stopwords)
          Deprecated. Use StopAnalyzer(Version, Reader) instead
StopAnalyzer(Reader stopwords, boolean enablePositionIncrements)
          Deprecated. Use StopAnalyzer(Version, Reader) instead
StopAnalyzer(Set stopWords)
          Deprecated. Use StopAnalyzer(Version, Set) instead
StopAnalyzer(Set stopWords, boolean enablePositionIncrements)
          Deprecated. Use StopAnalyzer(Version, Set) instead
StopAnalyzer(String[] stopWords)
          Deprecated. Use StopAnalyzer(Version, Set) instead
StopAnalyzer(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, File stopwordsFile)
          Builds an analyzer with the stop words from the given file.
StopAnalyzer(Version matchVersion, Reader stopwords)
          Builds an analyzer with the stop words from the given reader.
StopAnalyzer(Version matchVersion, Set stopWords)
          Builds an analyzer with the stop words from the given set.
 
Method Summary
 TokenStream reusableTokenStream(String fieldName, 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(String fieldName, 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 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 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(Set stopWords)
Deprecated. Use StopAnalyzer(Version, Set) instead

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


StopAnalyzer

public StopAnalyzer(Version matchVersion,
                    Set stopWords)
Builds an analyzer with the stop words from the given set.


StopAnalyzer

public StopAnalyzer(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(String[] stopWords)
Deprecated. Use StopAnalyzer(Version, Set) instead

Builds an analyzer which removes words in the provided array.


StopAnalyzer

public StopAnalyzer(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(File stopwordsFile)
             throws IOException
Deprecated. Use StopAnalyzer(Version, File) instead

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

Throws:
IOException
See Also:
WordlistLoader.getWordSet(File)

StopAnalyzer

public StopAnalyzer(File stopwordsFile,
                    boolean enablePositionIncrements)
             throws 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:
IOException
See Also:
WordlistLoader.getWordSet(File)

StopAnalyzer

public StopAnalyzer(Version matchVersion,
                    File stopwordsFile)
             throws IOException
Builds an analyzer with the stop words from the given file.

Parameters:
matchVersion - See above
stopwordsFile - File to load stop words from
Throws:
IOException
See Also:
WordlistLoader.getWordSet(File)

StopAnalyzer

public StopAnalyzer(Reader stopwords)
             throws IOException
Deprecated. Use StopAnalyzer(Version, Reader) instead

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

Throws:
IOException
See Also:
WordlistLoader.getWordSet(Reader)

StopAnalyzer

public StopAnalyzer(Reader stopwords,
                    boolean enablePositionIncrements)
             throws 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:
IOException
See Also:
WordlistLoader.getWordSet(Reader)

StopAnalyzer

public StopAnalyzer(Version matchVersion,
                    Reader stopwords)
             throws IOException
Builds an analyzer with the stop words from the given reader.

Parameters:
matchVersion - See above
stopwords - Reader to load stop words from
Throws:
IOException
See Also:
WordlistLoader.getWordSet(Reader)
Method Detail

tokenStream

public TokenStream tokenStream(String fieldName,
                               Reader reader)
Filters LowerCaseTokenizer with StopFilter.

Specified by:
tokenStream in class Analyzer

reusableTokenStream

public TokenStream reusableTokenStream(String fieldName,
                                       Reader reader)
                                throws 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:
IOException


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