Apache Lucene open-source search software
adding a constructor that takes stopwords as a Set
Daniel Naber28e16791913f
diff --git a/src/java/org/apache/lucene/analysis/StopAnalyzer.java b/src/java/org/apache/lucene/analysis/StopAnalyzer.javaindex 613dc2aa1d5..77455108aae 100644--- a/src/java/org/apache/lucene/analysis/StopAnalyzer.java+++ b/src/java/org/apache/lucene/analysis/StopAnalyzer.java@@ -41,6 +41,12 @@ public final class StopAnalyzer extends Analyzer {stopWords = StopFilter.makeStopSet(ENGLISH_STOP_WORDS);}+ /** Builds an analyzer with the stop words from the given set.+ */+ public StopAnalyzer(Set stopWords) {+ this.stopWords = stopWords;+ }+/** Builds an analyzer which removes words in the provided array. */public StopAnalyzer(String[] stopWords) {this.stopWords = StopFilter.makeStopSet(stopWords);diff --git a/src/java/org/apache/lucene/analysis/standard/StandardAnalyzer.java b/src/java/org/apache/lucene/analysis/standard/StandardAnalyzer.javaindex a84090f446d..9cb3bea0cb9 100644--- a/src/java/org/apache/lucene/analysis/standard/StandardAnalyzer.java+++ b/src/java/org/apache/lucene/analysis/standard/StandardAnalyzer.java@@ -41,6 +41,11 @@ public class StandardAnalyzer extends Analyzer {this(STOP_WORDS);}+ /** Builds an analyzer with the given stop words. */+ public StandardAnalyzer(Set stopWords) {+ stopSet = stopWords;+ }+/** Builds an analyzer with the given stop words. */public StandardAnalyzer(String[] stopWords) {stopSet = StopFilter.makeStopSet(stopWords);