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

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

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

Analysis.getWordSet介绍

暂无

代码示例

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

public KeepWordFilterFactory(IndexSettings indexSettings,
               Environment env, String name, Settings settings) {
  super(indexSettings, name, settings);
  final String[] arrayKeepWords = settings.getAsArray(KEEP_WORDS_KEY, null);
  final String keepWordsPath = settings.get(KEEP_WORDS_PATH_KEY, null);
  if ((arrayKeepWords == null && keepWordsPath == null) || (arrayKeepWords != null && keepWordsPath != null)) {
    // we don't allow both or none
    throw new IllegalArgumentException("keep requires either `" + KEEP_WORDS_KEY + "` or `"
        + KEEP_WORDS_PATH_KEY + "` to be configured");
  }
  if (settings.get(ENABLE_POS_INC_KEY) != null) {
    throw new IllegalArgumentException(ENABLE_POS_INC_KEY + " is not supported anymore. Please fix your analysis chain");
  }
  this.keepWords = Analysis.getWordSet(env, settings, KEEP_WORDS_KEY);
}

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

public AbstractCompoundWordTokenFilterFactory(IndexSettings indexSettings, Environment env, String name, Settings settings) {
    super(indexSettings, name, settings);

    minWordSize = settings.getAsInt("min_word_size", CompoundWordTokenFilterBase.DEFAULT_MIN_WORD_SIZE);
    minSubwordSize = settings.getAsInt("min_subword_size", CompoundWordTokenFilterBase.DEFAULT_MIN_SUBWORD_SIZE);
    maxSubwordSize = settings.getAsInt("max_subword_size", CompoundWordTokenFilterBase.DEFAULT_MAX_SUBWORD_SIZE);
    onlyLongestMatch = settings.getAsBoolean("only_longest_match", false);
    wordList = Analysis.getWordSet(env, settings, "word_list");
    if (wordList == null) {
      throw new IllegalArgumentException("word_list must be provided for [" + name + "], either as a path to a file, or directly");
    }
  }
}

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

KeepWordFilterFactory(IndexSettings indexSettings, Environment env, String name, Settings settings) {
  super(indexSettings, name, settings);
  final List<String> arrayKeepWords = settings.getAsList(KEEP_WORDS_KEY, null);
  final String keepWordsPath = settings.get(KEEP_WORDS_PATH_KEY, null);
  if ((arrayKeepWords == null && keepWordsPath == null) || (arrayKeepWords != null && keepWordsPath != null)) {
    // we don't allow both or none
    throw new IllegalArgumentException("keep requires either `" + KEEP_WORDS_KEY + "` or `"
        + KEEP_WORDS_PATH_KEY + "` to be configured");
  }
  if (settings.get(ENABLE_POS_INC_KEY) != null) {
    throw new IllegalArgumentException(ENABLE_POS_INC_KEY + " is not supported anymore. Please fix your analysis chain");
  }
  this.keepWords = Analysis.getWordSet(env, indexSettings.getIndexVersionCreated(), settings, KEEP_WORDS_KEY);
}

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

public KeywordMarkerTokenFilterFactory(IndexSettings indexSettings, Environment env, String name, Settings settings) {
  super(indexSettings, name, settings);
  boolean ignoreCase = settings.getAsBoolean("ignore_case", false);
  String patternString = settings.get("keywords_pattern");
  if (patternString != null) {
    // a pattern for matching keywords is specified, as opposed to a
    // set of keyword strings to match against
    if (settings.get("keywords") != null || settings.get("keywords_path") != null) {
      throw new IllegalArgumentException(
        "cannot specify both `keywords_pattern` and `keywords` or `keywords_path`");
    }
    keywordPattern = Pattern.compile(patternString);
    keywordLookup = null;
  } else {
    Set<?> rules = Analysis.getWordSet(env, settings, "keywords");
    if (rules == null) {
      throw new IllegalArgumentException(
        "keyword filter requires either `keywords`, `keywords_path`, " +
        "or `keywords_pattern` to be configured");
    }
    // a set of keywords (or a path to them) is specified
    keywordLookup = new CharArraySet(rules, ignoreCase);
    keywordPattern = null;
  }
}

代码示例来源:origin: harbby/presto-connectors

@Inject
public KeywordMarkerTokenFilterFactory(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
  super(index, indexSettingsService.getSettings(), name, settings);
  boolean ignoreCase = settings.getAsBoolean("ignore_case", false);
  Set<?> rules = Analysis.getWordSet(env, settings, "keywords");
  if (rules == null) {
    throw new IllegalArgumentException("keyword filter requires either `keywords` or `keywords_path` to be configured");
  }
  keywordLookup = new CharArraySet(rules, ignoreCase);
}

代码示例来源:origin: harbby/presto-connectors

public AbstractCompoundWordTokenFilterFactory(Index index, Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettings, name, settings);

    minWordSize = settings.getAsInt("min_word_size", CompoundWordTokenFilterBase.DEFAULT_MIN_WORD_SIZE);
    minSubwordSize = settings.getAsInt("min_subword_size", CompoundWordTokenFilterBase.DEFAULT_MIN_SUBWORD_SIZE);
    maxSubwordSize = settings.getAsInt("max_subword_size", CompoundWordTokenFilterBase.DEFAULT_MAX_SUBWORD_SIZE);
    onlyLongestMatch = settings.getAsBoolean("only_longest_match", false);
    wordList = Analysis.getWordSet(env, settings, "word_list");
    if (wordList == null) {
      throw new IllegalArgumentException("word_list must be provided for [" + name + "], either as a path to a file, or directly");
    }
  }
}

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

protected AbstractCompoundWordTokenFilterFactory(IndexSettings indexSettings, Environment env, String name, Settings settings) {
  super(indexSettings, name, settings);
  minWordSize = settings.getAsInt("min_word_size", CompoundWordTokenFilterBase.DEFAULT_MIN_WORD_SIZE);
  minSubwordSize = settings.getAsInt("min_subword_size", CompoundWordTokenFilterBase.DEFAULT_MIN_SUBWORD_SIZE);
  maxSubwordSize = settings.getAsInt("max_subword_size", CompoundWordTokenFilterBase.DEFAULT_MAX_SUBWORD_SIZE);
  onlyLongestMatch = settings
    .getAsBooleanLenientForPreEs6Indices(indexSettings.getIndexVersionCreated(), "only_longest_match", false, deprecationLogger);
  wordList = Analysis.getWordSet(env, indexSettings.getIndexVersionCreated(), settings, "word_list");
  if (wordList == null) {
    throw new IllegalArgumentException("word_list must be provided for [" + name + "], either as a path to a file, or directly");
  }
}

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

KeywordMarkerTokenFilterFactory(IndexSettings indexSettings, Environment env, String name, Settings settings) {
  super(indexSettings, name, settings);
  boolean ignoreCase =
    settings.getAsBooleanLenientForPreEs6Indices(indexSettings.getIndexVersionCreated(), "ignore_case", false, deprecationLogger);
  String patternString = settings.get("keywords_pattern");
  if (patternString != null) {
    // a pattern for matching keywords is specified, as opposed to a
    // set of keyword strings to match against
    if (settings.get("keywords") != null || settings.get("keywords_path") != null) {
      throw new IllegalArgumentException(
        "cannot specify both `keywords_pattern` and `keywords` or `keywords_path`");
    }
    keywordPattern = Pattern.compile(patternString);
    keywordLookup = null;
  } else {
    Set<?> rules = Analysis.getWordSet(env, indexSettings.getIndexVersionCreated(), settings, "keywords");
    if (rules == null) {
      throw new IllegalArgumentException(
        "keyword filter requires either `keywords`, `keywords_path`, " +
        "or `keywords_pattern` to be configured");
    }
    // a set of keywords (or a path to them) is specified
    keywordLookup = new CharArraySet(rules, ignoreCase);
    keywordPattern = null;
  }
}

代码示例来源:origin: harbby/presto-connectors

@Inject
public KeepWordFilterFactory(Index index, IndexSettingsService indexSettingsService,
               Environment env, @Assisted String name, @Assisted Settings settings) {
  super(index, indexSettingsService.getSettings(), name, settings);
  final String[] arrayKeepWords = settings.getAsArray(KEEP_WORDS_KEY, null);
  final String keepWordsPath = settings.get(KEEP_WORDS_PATH_KEY, null);
  if ((arrayKeepWords == null && keepWordsPath == null) || (arrayKeepWords != null && keepWordsPath != null)) {
    // we don't allow both or none
    throw new IllegalArgumentException("keep requires either `" + KEEP_WORDS_KEY + "` or `"
        + KEEP_WORDS_PATH_KEY + "` to be configured");
  }
  if (version.onOrAfter(Version.LUCENE_4_4) && settings.get(ENABLE_POS_INC_KEY) != null) {
    throw new IllegalArgumentException(ENABLE_POS_INC_KEY + " is not supported anymore. Please fix your analysis chain or use"
        + " an older compatibility version (<=4.3) but beware that it might cause highlighting bugs.");
  }
  enablePositionIncrements = version.onOrAfter(Version.LUCENE_4_4) ? true : settings.getAsBoolean(ENABLE_POS_INC_KEY, true);
  this.keepWords = Analysis.getWordSet(env, settings, KEEP_WORDS_KEY);
}

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

Set<?> protectedWords = Analysis.getWordSet(env, settings, "protected_words");
this.protoWords = protectedWords == null ? null : CharArraySet.copy(protectedWords);
this.flags = flags;

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

Set<?> protectedWords = Analysis.getWordSet(env, settings, "protected_words");
this.protoWords = protectedWords == null ? null : CharArraySet.copy(protectedWords);
this.flags = flags;

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

Set<?> protectedWords = Analysis.getWordSet(env, indexSettings.getIndexVersionCreated(),
    settings, "protected_words");
this.protoWords = protectedWords == null ? null : CharArraySet.copy(protectedWords);

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

Set<?> protectedWords = Analysis.getWordSet(env, indexSettings.getIndexVersionCreated(),
    settings, "protected_words");
this.protoWords = protectedWords == null ? null : CharArraySet.copy(protectedWords);

代码示例来源:origin: harbby/presto-connectors

Set<?> protectedWords = Analysis.getWordSet(env, settings, "protected_words");
this.protoWords = protectedWords == null ? null : CharArraySet.copy(protectedWords);
this.flags = flags;

相关文章