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.


Field Summary
static String[] ENGLISH_STOP_WORDS
          An array containing some common English words that are not usually useful for searching.
 
Constructor Summary
StopAnalyzer()
          Builds an analyzer which removes words in ENGLISH_STOP_WORDS.
StopAnalyzer(File stopwordsFile)
          Builds an analyzer with the stop words from the given file.
StopAnalyzer(Reader stopwords)
          Builds an analyzer with the stop words from the given reader.
StopAnalyzer(Set stopWords)
          Builds an analyzer with the stop words from the given set.
StopAnalyzer(String[] stopWords)
          Builds an analyzer which removes words in the provided array.
 
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
getPositionIncrementGap, getPreviousTokenStream, 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
An array containing some common English words that are not usually useful for searching.

Constructor Detail

StopAnalyzer

public StopAnalyzer()
Builds an analyzer which removes words in ENGLISH_STOP_WORDS.


StopAnalyzer

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


StopAnalyzer

public StopAnalyzer(String[] stopWords)
Builds an analyzer which removes words in the provided array.


StopAnalyzer

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

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

StopAnalyzer

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

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-2008 Apache Software Foundation. All Rights Reserved.