Skip to content

Commit

Permalink
allow to sepcify stopwords as comma delimiated list of words
Browse files Browse the repository at this point in the history
  • Loading branch information
kimchy committed Sep 26, 2010
1 parent efe5b57 commit d9c2cc9
Showing 1 changed file with 7 additions and 2 deletions.
Expand Up @@ -19,6 +19,7 @@

package org.elasticsearch.index.analysis;

import org.elasticsearch.common.Strings;
import org.elasticsearch.common.collect.ImmutableSet;
import org.elasticsearch.common.collect.Iterators;
import org.elasticsearch.common.settings.Settings;
Expand All @@ -37,8 +38,12 @@ public static boolean isNoStopwords(Settings settings) {

public static Set<?> parseStopWords(Settings settings, Set<?> defaultStopWords) {
String value = settings.get("stopwords");
if (value != null && "_none_".equals(value)) {
return ImmutableSet.of();
if (value != null) {
if ("_none_".equals(value)) {
return ImmutableSet.of();
} else {
return ImmutableSet.copyOf(Strings.commaDelimitedListToSet(value));
}
}
String[] stopWords = settings.getAsArray("stopwords", null);
if (stopWords != null) {
Expand Down

0 comments on commit d9c2cc9

Please sign in to comment.