allow to sepcify stopwords as comma delimiated list of words
This commit is contained in:
parent
efe5b5734c
commit
d9c2cc9d37
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
package org.elasticsearch.index.analysis;
|
package org.elasticsearch.index.analysis;
|
||||||
|
|
||||||
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.collect.ImmutableSet;
|
import org.elasticsearch.common.collect.ImmutableSet;
|
||||||
import org.elasticsearch.common.collect.Iterators;
|
import org.elasticsearch.common.collect.Iterators;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -37,8 +38,12 @@ public class Analysis {
|
||||||
|
|
||||||
public static Set<?> parseStopWords(Settings settings, Set<?> defaultStopWords) {
|
public static Set<?> parseStopWords(Settings settings, Set<?> defaultStopWords) {
|
||||||
String value = settings.get("stopwords");
|
String value = settings.get("stopwords");
|
||||||
if (value != null && "_none_".equals(value)) {
|
if (value != null) {
|
||||||
return ImmutableSet.of();
|
if ("_none_".equals(value)) {
|
||||||
|
return ImmutableSet.of();
|
||||||
|
} else {
|
||||||
|
return ImmutableSet.copyOf(Strings.commaDelimitedListToSet(value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
String[] stopWords = settings.getAsArray("stopwords", null);
|
String[] stopWords = settings.getAsArray("stopwords", null);
|
||||||
if (stopWords != null) {
|
if (stopWords != null) {
|
||||||
|
|
Loading…
Reference in New Issue