org.elasticsearch.index.analysis.Analysis.getWordList()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(9.6k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中org.elasticsearch.index.analysis.Analysis.getWordList()方法的一些代码示例,展示了Analysis.getWordList()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Analysis.getWordList()方法的具体详情如下:
包路径:org.elasticsearch.index.analysis.Analysis
类名称:Analysis
方法名:getWordList

Analysis.getWordList介绍

[英]Fetches a list of words from the specified settings file. The list should either be available at the key specified by settingsPrefix or in a file specified by settingsPrefix + _path.
[中]从指定的设置文件中获取单词列表。该列表应位于settingsPrefix指定的键处,或位于settingsPrefix+\u路径指定的文件中。

代码示例

代码示例来源:origin: org.elasticsearch/elasticsearch

/**
 * Fetches a list of words from the specified settings file. The list should either be available at the key
 * specified by settingsPrefix or in a file specified by settingsPrefix + _path.
 *
 * @throws IllegalArgumentException
 *          If the word list cannot be found at either key.
 */
public static List<String> getWordList(Environment env, Settings settings, String settingPrefix) {
  return getWordList(env, settings, settingPrefix + "_path", settingPrefix);
}

代码示例来源:origin: org.elasticsearch/elasticsearch

protected Reader getRulesFromSettings(Environment env) {
  Reader rulesReader;
  if (settings.getAsList("synonyms", null) != null) {
    List<String> rulesList = Analysis.getWordList(env, settings, "synonyms");
    StringBuilder sb = new StringBuilder();
    for (String line : rulesList) {
      sb.append(line).append(System.lineSeparator());
    }
    rulesReader = new StringReader(sb.toString());
  } else if (settings.get("synonyms_path") != null) {
    rulesReader = Analysis.getReaderFromFile(env, settings, "synonyms_path");
  } else {
    throw new IllegalArgumentException("synonym requires either `synonyms` or `synonyms_path` to be configured");
  }
  return rulesReader;
}

代码示例来源:origin: org.elasticsearch/elasticsearch

public static CharArraySet getWordSet(Environment env, org.elasticsearch.Version indexCreatedVersion, Settings settings,
                   String settingsPrefix) {
  List<String> wordList = getWordList(env, settings, settingsPrefix);
  if (wordList == null) {
    return null;
  }
  boolean ignoreCase =
    settings.getAsBooleanLenientForPreEs6Indices(indexCreatedVersion, settingsPrefix + "_case", false, deprecationLogger);
  return new CharArraySet(wordList, ignoreCase);
}

代码示例来源:origin: org.elasticsearch/elasticsearch

public static CharArraySet parseWords(Environment env, Settings settings, String name, CharArraySet defaultWords,
                   Map<String, Set<?>> namedWords, boolean ignoreCase) {
  String value = settings.get(name);
  if (value != null) {
    if ("_none_".equals(value)) {
      return CharArraySet.EMPTY_SET;
    } else {
      return resolveNamedWords(settings.getAsList(name), namedWords, ignoreCase);
    }
  }
  List<String> pathLoadedWords = getWordList(env, settings, name);
  if (pathLoadedWords != null) {
    return resolveNamedWords(pathLoadedWords, namedWords, ignoreCase);
  }
  return defaultWords;
}

代码示例来源:origin: org.codelibs/elasticsearch-analysis-ja

public PosConcatenationFilterFactory(final IndexSettings indexSettings, final Environment environment, final String name, final Settings settings) {
  super(indexSettings, name, settings);
  final List<String> tagList = Analysis.getWordList(environment, settings, "tags");
  if (tagList != null) {
    posTags.addAll(tagList);
  }
}

代码示例来源:origin: codelibs/elasticsearch-analysis-kuromoji-neologd

public PosConcatenationFilterFactory(IndexSettings indexSettings, Environment environment, String name, Settings settings) {
  super(indexSettings, name, settings);
  List<String> tagList = Analysis.getWordList(environment, settings, "tags");
  if (tagList != null) {
    posTags.addAll(tagList);
  }
}

代码示例来源:origin: org.codelibs/elasticsearch-analysis-ja

public KuromojiPartOfSpeechFilterFactory(final IndexSettings indexSettings, final Environment env, final String name, final Settings settings) {
  super(indexSettings, name, settings);
  final List<String> wordList = Analysis.getWordList(env, settings, "stoptags");
  if (wordList != null) {
    stopTags.addAll(wordList);
  }
}

代码示例来源:origin: org.codelibs/elasticsearch-analysis-kuromoji-neologd

public PosConcatenationFilterFactory(IndexSettings indexSettings, Environment environment, String name, Settings settings) {
  super(indexSettings, name, settings);
  List<String> tagList = Analysis.getWordList(environment, settings, "tags");
  if (tagList != null) {
    posTags.addAll(tagList);
  }
}

代码示例来源:origin: org.codelibs/elasticsearch-analysis-ja

public KuromojiPartOfSpeechFilterFactory(final IndexSettings indexSettings, final Environment environment, final String name, final Settings settings) {
  super(indexSettings, name, settings);
  final List<String> wordList = Analysis.getWordList(environment, settings, "stoptags");
  if (wordList != null) {
    stopTags.addAll(wordList);
  }
}

代码示例来源:origin: codelibs/elasticsearch-analysis-kuromoji-neologd

public KuromojiPartOfSpeechFilterFactory(IndexSettings indexSettings, Environment env, String name, Settings settings) {
  super(indexSettings, name, settings);
  List<String> wordList = Analysis.getWordList(env, settings, "stoptags");
  if (wordList != null) {
    stopTags.addAll(wordList);
  } else {
    stopTags.addAll(JapaneseAnalyzer.getDefaultStopTags());
  }
}

代码示例来源:origin: org.codelibs/elasticsearch-analysis-kuromoji-neologd

public KuromojiPartOfSpeechFilterFactory(IndexSettings indexSettings, Environment env, String name, Settings settings) {
  super(indexSettings, name, settings);
  List<String> wordList = Analysis.getWordList(env, settings, "stoptags");
  if (wordList != null) {
    stopTags.addAll(wordList);
  } else {
    stopTags.addAll(JapaneseAnalyzer.getDefaultStopTags());
  }
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

public static CharArraySet getWordSet(Environment env, Settings settings, String settingsPrefix) {
  List<String> wordList = getWordList(env, settings, settingsPrefix);
  if (wordList == null) {
    return null;
  }
  return new CharArraySet(wordList, settings.getAsBoolean(settingsPrefix + "_case", false));
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

public static CharArraySet getWordSet(Environment env, org.elasticsearch.Version indexCreatedVersion, Settings settings,
                   String settingsPrefix) {
  List<String> wordList = getWordList(env, settings, settingsPrefix);
  if (wordList == null) {
    return null;
  }
  boolean ignoreCase =
    settings.getAsBooleanLenientForPreEs6Indices(indexCreatedVersion, settingsPrefix + "_case", false, deprecationLogger);
  return new CharArraySet(wordList, ignoreCase);
}

代码示例来源:origin: apache/servicemix-bundles

public static CharArraySet getWordSet(Environment env, org.elasticsearch.Version indexCreatedVersion, Settings settings,
                   String settingsPrefix) {
  List<String> wordList = getWordList(env, settings, settingsPrefix);
  if (wordList == null) {
    return null;
  }
  boolean ignoreCase =
    settings.getAsBooleanLenientForPreEs6Indices(indexCreatedVersion, settingsPrefix + "_case", false, deprecationLogger);
  return new CharArraySet(wordList, ignoreCase);
}

代码示例来源:origin: org.codelibs.elasticsearch.module/analysis-common

StemmerOverrideTokenFilterFactory(IndexSettings indexSettings, Environment env, String name, Settings settings) throws IOException {
  super(indexSettings, name, settings);
  List<String> rules = Analysis.getWordList(env, settings, "rules");
  if (rules == null) {
    throw new IllegalArgumentException("stemmer override filter requires either `rules` or `rules_path` to be configured");
  }
  StemmerOverrideFilter.Builder builder = new StemmerOverrideFilter.Builder(false);
  parseRules(rules, builder, "=>");
  overrideMap = builder.build();
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

public MappingCharFilterFactory(IndexSettings indexSettings, Environment env, String name, Settings settings) {
  super(indexSettings, name);
  List<String> rules = Analysis.getWordList(env, settings, "mappings");
  if (rules == null) {
    throw new IllegalArgumentException("mapping requires either `mappings` or `mappings_path` to be configured");
  }
  NormalizeCharMap.Builder normMapBuilder = new NormalizeCharMap.Builder();
  parseRules(rules, normMapBuilder);
  normMap = normMapBuilder.build();
}

代码示例来源:origin: org.codelibs.elasticsearch.module/analysis-common

MappingCharFilterFactory(IndexSettings indexSettings, Environment env, String name, Settings settings) {
  super(indexSettings, name);
  List<String> rules = Analysis.getWordList(env, settings, "mappings");
  if (rules == null) {
    throw new IllegalArgumentException("mapping requires either `mappings` or `mappings_path` to be configured");
  }
  NormalizeCharMap.Builder normMapBuilder = new NormalizeCharMap.Builder();
  parseRules(rules, normMapBuilder);
  normMap = normMapBuilder.build();
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

public StemmerOverrideTokenFilterFactory(IndexSettings indexSettings, Environment env, String name, Settings settings) throws IOException {
  super(indexSettings, name, settings);
  List<String> rules = Analysis.getWordList(env, settings, "rules");
  if (rules == null) {
    throw new IllegalArgumentException("stemmer override filter requires either `rules` or `rules_path` to be configured");
  }
  StemmerOverrideFilter.Builder builder = new StemmerOverrideFilter.Builder(false);
  parseRules(rules, builder, "=>");
  overrideMap = builder.build();
}

代码示例来源:origin: org.elasticsearch/elasticsearch-analysis-kuromoji

@Inject
public KuromojiPartOfSpeechFilterFactory(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
  super(index, indexSettings, name, settings);
  List<String> wordList = Analysis.getWordList(env, settings, "stoptags");
  if (wordList != null) {
    stopTags.addAll(wordList);
  }
}

代码示例来源:origin: org.elasticsearch.plugin/analysis-kuromoji

@Inject
public KuromojiPartOfSpeechFilterFactory(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
  super(index, indexSettingsService.getSettings(), name, settings);
  List<String> wordList = Analysis.getWordList(env, settings, "stoptags");
  if (wordList != null) {
    stopTags.addAll(wordList);
  }
}

相关文章