Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

another refinement to the ongoing StopFilter refactorings

Erik Hatcher8d7ce21934a4
diff --git a/src/java/org/apache/lucene/analysis/StopFilter.java b/src/java/org/apache/lucene/analysis/StopFilter.java
index c255a886756..0acf1cc2e59 100644
--- a/src/java/org/apache/lucene/analysis/StopFilter.java
+++ b/src/java/org/apache/lucene/analysis/StopFilter.java
@@ -65,7 +65,7 @@ import java.util.Set;
public final class StopFilter extends TokenFilter {
- private Set table;
+ private Set stopWords;
/**
* Constructs a filter which removes words from the input
@@ -73,7 +73,7 @@ public final class StopFilter extends TokenFilter {
*/
public StopFilter(TokenStream in, String[] stopWords) {
super(in);
- table = makeStopSet(stopWords);
+ this.stopWords = makeStopSet(stopWords);
}
/**
@@ -84,16 +84,16 @@ public final class StopFilter extends TokenFilter {
*/
public StopFilter(TokenStream in, Hashtable stopTable) {
super(in);
- table = stopTable.keySet();
+ stopWords = new HashSet(stopTable.keySet());
}
/**
* Constructs a filter which removes words from the input
* TokenStream that are named in the Set.
*/
- public StopFilter(TokenStream in, Set stopTable) {
+ public StopFilter(TokenStream in, Set stopWords) {
super(in);
- table = stopTable;
+ this.stopWords = new HashSet(stopWords);
}
/**
@@ -114,7 +114,7 @@ public final class StopFilter extends TokenFilter {
/**
* Builds a Set from an array of stop words,
* appropriate for passing into the StopFilter constructor.
- * This permits this table construction to be cached once when
+ * This permits this stopWords construction to be cached once when
* an Analyzer is constructed.
*/
public static final Set makeStopSet(String[] stopWords) {
@@ -130,7 +130,7 @@ public final class StopFilter extends TokenFilter {
public final Token next() throws IOException {
// return the first non-stop word found
for (Token token = input.next(); token != null; token = input.next())
- if (!table.contains(token.termText))
+ if (!stopWords.contains(token.termText))
return token;
// reached EOS -- return null
return null;