mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 02:14:54 +00:00
Analysis: When specifying empty array for stopwords, use an empty list for stopwords, closes #230.
This commit is contained in:
parent
8e4c139c8b
commit
22926f0026
@ -221,6 +221,14 @@ public interface Settings {
|
||||
*/
|
||||
String[] getAsArray(String settingPrefix, String[] defaultArray) throws SettingsException;
|
||||
|
||||
/**
|
||||
* The values associated with a setting prefix as an array. The settings array is in the format of:
|
||||
* <tt>settingPrefix.[index]</tt>.
|
||||
*
|
||||
* @param settingPrefix The setting prefix to load the array by
|
||||
* @return The setting array values
|
||||
* @throws SettingsException
|
||||
*/
|
||||
String[] getAsArray(String settingPrefix) throws SettingsException;
|
||||
|
||||
/**
|
||||
|
@ -42,8 +42,8 @@ public class ArabicAnalyzerProvider extends AbstractIndexAnalyzerProvider<Arabic
|
||||
|
||||
@Inject public ArabicAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
||||
super(index, indexSettings, name);
|
||||
String[] stopWords = settings.getAsArray("stopwords");
|
||||
if (stopWords.length > 0) {
|
||||
String[] stopWords = settings.getAsArray("stopwords", null);
|
||||
if (stopWords != null) {
|
||||
this.stopWords = ImmutableSet.copyOf(Iterators.forArray(stopWords));
|
||||
} else {
|
||||
this.stopWords = ArabicAnalyzer.getDefaultStopSet();
|
||||
|
@ -44,8 +44,8 @@ public class BrazilianAnalyzerProvider extends AbstractIndexAnalyzerProvider<Bra
|
||||
|
||||
@Inject public BrazilianAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
||||
super(index, indexSettings, name);
|
||||
String[] stopWords = settings.getAsArray("stopwords");
|
||||
if (stopWords.length > 0) {
|
||||
String[] stopWords = settings.getAsArray("stopwords", null);
|
||||
if (stopWords != null) {
|
||||
this.stopWords = ImmutableSet.copyOf(Iterators.forArray(stopWords));
|
||||
} else {
|
||||
this.stopWords = BrazilianAnalyzer.getDefaultStopSet();
|
||||
|
@ -42,8 +42,8 @@ public class CjkAnalyzerProvider extends AbstractIndexAnalyzerProvider<CJKAnalyz
|
||||
|
||||
@Inject public CjkAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
||||
super(index, indexSettings, name);
|
||||
String[] stopWords = settings.getAsArray("stopwords");
|
||||
if (stopWords.length > 0) {
|
||||
String[] stopWords = settings.getAsArray("stopwords", null);
|
||||
if (stopWords != null) {
|
||||
this.stopWords = ImmutableSet.copyOf(Iterators.forArray(stopWords));
|
||||
} else {
|
||||
this.stopWords = CJKAnalyzer.getDefaultStopSet();
|
||||
|
@ -42,8 +42,8 @@ public class CzechAnalyzerProvider extends AbstractIndexAnalyzerProvider<CzechAn
|
||||
|
||||
@Inject public CzechAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
||||
super(index, indexSettings, name);
|
||||
String[] stopWords = settings.getAsArray("stopwords");
|
||||
if (stopWords.length > 0) {
|
||||
String[] stopWords = settings.getAsArray("stopwords", null);
|
||||
if (stopWords != null) {
|
||||
this.stopWords = ImmutableSet.copyOf(Iterators.forArray(stopWords));
|
||||
} else {
|
||||
this.stopWords = CzechAnalyzer.getDefaultStopSet();
|
||||
|
@ -44,8 +44,8 @@ public class DutchAnalyzerProvider extends AbstractIndexAnalyzerProvider<DutchAn
|
||||
|
||||
@Inject public DutchAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
||||
super(index, indexSettings, name);
|
||||
String[] stopWords = settings.getAsArray("stopwords");
|
||||
if (stopWords.length > 0) {
|
||||
String[] stopWords = settings.getAsArray("stopwords", null);
|
||||
if (stopWords != null) {
|
||||
this.stopWords = ImmutableSet.copyOf(Iterators.forArray(stopWords));
|
||||
} else {
|
||||
this.stopWords = DutchAnalyzer.getDefaultStopSet();
|
||||
|
@ -44,8 +44,8 @@ public class FrenchAnalyzerProvider extends AbstractIndexAnalyzerProvider<French
|
||||
|
||||
@Inject public FrenchAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
||||
super(index, indexSettings, name);
|
||||
String[] stopWords = settings.getAsArray("stopwords");
|
||||
if (stopWords.length > 0) {
|
||||
String[] stopWords = settings.getAsArray("stopwords", null);
|
||||
if (stopWords != null) {
|
||||
this.stopWords = ImmutableSet.copyOf(Iterators.forArray(stopWords));
|
||||
} else {
|
||||
this.stopWords = FrenchAnalyzer.getDefaultStopSet();
|
||||
|
@ -44,8 +44,8 @@ public class GermanAnalyzerProvider extends AbstractIndexAnalyzerProvider<German
|
||||
|
||||
@Inject public GermanAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
||||
super(index, indexSettings, name);
|
||||
String[] stopWords = settings.getAsArray("stopwords");
|
||||
if (stopWords.length > 0) {
|
||||
String[] stopWords = settings.getAsArray("stopwords", null);
|
||||
if (stopWords != null) {
|
||||
this.stopWords = ImmutableSet.copyOf(Iterators.forArray(stopWords));
|
||||
} else {
|
||||
this.stopWords = GermanAnalyzer.getDefaultStopSet();
|
||||
|
@ -42,8 +42,8 @@ public class GreekAnalyzerProvider extends AbstractIndexAnalyzerProvider<GreekAn
|
||||
|
||||
@Inject public GreekAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
||||
super(index, indexSettings, name);
|
||||
String[] stopWords = settings.getAsArray("stopwords");
|
||||
if (stopWords.length > 0) {
|
||||
String[] stopWords = settings.getAsArray("stopwords", null);
|
||||
if (stopWords != null) {
|
||||
this.stopWords = ImmutableSet.copyOf(Iterators.forArray(stopWords));
|
||||
} else {
|
||||
this.stopWords = GreekAnalyzer.getDefaultStopSet();
|
||||
|
@ -42,8 +42,8 @@ public class PersianAnalyzerProvider extends AbstractIndexAnalyzerProvider<Persi
|
||||
|
||||
@Inject public PersianAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
||||
super(index, indexSettings, name);
|
||||
String[] stopWords = settings.getAsArray("stopwords");
|
||||
if (stopWords.length > 0) {
|
||||
String[] stopWords = settings.getAsArray("stopwords", null);
|
||||
if (stopWords != null) {
|
||||
this.stopWords = ImmutableSet.copyOf(Iterators.forArray(stopWords));
|
||||
} else {
|
||||
this.stopWords = PersianAnalyzer.getDefaultStopSet();
|
||||
|
@ -38,8 +38,8 @@ public class RussianAnalyzerProvider extends AbstractIndexAnalyzerProvider<Russi
|
||||
|
||||
@Inject public RussianAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
||||
super(index, indexSettings, name);
|
||||
String[] stopWords = settings.getAsArray("stopwords");
|
||||
if (stopWords.length > 0) {
|
||||
String[] stopWords = settings.getAsArray("stopwords", null);
|
||||
if (stopWords != null) {
|
||||
analyzer = new RussianAnalyzer(Lucene.ANALYZER_VERSION, ImmutableSet.copyOf(Iterators.forArray(stopWords)));
|
||||
} else {
|
||||
analyzer = new RussianAnalyzer(Lucene.ANALYZER_VERSION);
|
||||
|
@ -45,8 +45,8 @@ public class StandardAnalyzerProvider extends AbstractIndexAnalyzerProvider<Stan
|
||||
|
||||
@Inject public StandardAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
||||
super(index, indexSettings, name);
|
||||
String[] stopWords = settings.getAsArray("stopwords");
|
||||
if (stopWords.length > 0) {
|
||||
String[] stopWords = settings.getAsArray("stopwords", null);
|
||||
if (stopWords != null) {
|
||||
this.stopWords = ImmutableSet.copyOf(Iterators.forArray(stopWords));
|
||||
} else {
|
||||
this.stopWords = ImmutableSet.copyOf((Iterable<? extends String>) StopAnalyzer.ENGLISH_STOP_WORDS_SET);
|
||||
|
@ -42,8 +42,8 @@ public class StopAnalyzerProvider extends AbstractIndexAnalyzerProvider<StopAnal
|
||||
|
||||
@Inject public StopAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
||||
super(index, indexSettings, name);
|
||||
String[] stopWords = settings.getAsArray("stopwords");
|
||||
if (stopWords.length > 0) {
|
||||
String[] stopWords = settings.getAsArray("stopwords", null);
|
||||
if (stopWords != null) {
|
||||
this.stopWords = ImmutableSet.copyOf(Iterators.forArray(stopWords));
|
||||
} else {
|
||||
this.stopWords = ImmutableSet.copyOf((Iterable<? extends String>) StopAnalyzer.ENGLISH_STOP_WORDS_SET);
|
||||
|
@ -45,8 +45,8 @@ public class StopTokenFilterFactory extends AbstractTokenFilterFactory {
|
||||
|
||||
@Inject public StopTokenFilterFactory(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
|
||||
super(index, indexSettings, name);
|
||||
String[] stopWords = settings.getAsArray("stopwords");
|
||||
if (stopWords.length > 0) {
|
||||
String[] stopWords = settings.getAsArray("stopwords", null);
|
||||
if (stopWords != null) {
|
||||
this.stopWords = ImmutableSet.copyOf(Iterators.forArray(stopWords));
|
||||
} else {
|
||||
this.stopWords = ImmutableSet.copyOf((Iterable<? extends String>) StopAnalyzer.ENGLISH_STOP_WORDS_SET);
|
||||
|
Loading…
x
Reference in New Issue
Block a user