Skip to content

Apache Lucene open-source search software

new method to get stop words from reader

Daniel Naber00b3e9d8a482
diff --git a/src/java/org/apache/lucene/analysis/StopAnalyzer.java b/src/java/org/apache/lucene/analysis/StopAnalyzer.java
index 7ac1b3f1ce6..613dc2aa1d5 100644
--- a/src/java/org/apache/lucene/analysis/StopAnalyzer.java
+++ b/src/java/org/apache/lucene/analysis/StopAnalyzer.java
@@ -46,11 +46,20 @@ public final class StopAnalyzer extends Analyzer {
this.stopWords = StopFilter.makeStopSet(stopWords);
}
- /** Builds an analyzer with the stop words from the given file. */
+ /** Builds an analyzer with the stop words from the given file.
+ * @see WordlistLoader#getWordSet(File)
+ */
public StopAnalyzer(File stopwordsFile) throws IOException {
stopWords = WordlistLoader.getWordSet(stopwordsFile);
}
+ /** Builds an analyzer with the stop words from the given reader.
+ * @see WordlistLoader#getWordSet(Reader)
+ */
+ public StopAnalyzer(Reader stopwords) throws IOException {
+ stopWords = WordlistLoader.getWordSet(stopwords);
+ }
+
/** Filters LowerCaseTokenizer with StopFilter. */
public TokenStream tokenStream(String fieldName, Reader reader) {
return new StopFilter(new LowerCaseTokenizer(reader), stopWords);