当前位置: 首页>>代码示例>>Java>>正文


Java CharArraySet.add方法代码示例

本文整理汇总了Java中org.apache.lucene.analysis.CharArraySet.add方法的典型用法代码示例。如果您正苦于以下问题:Java CharArraySet.add方法的具体用法?Java CharArraySet.add怎么用?Java CharArraySet.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.lucene.analysis.CharArraySet的用法示例。


在下文中一共展示了CharArraySet.add方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resolveNamedWords

import org.apache.lucene.analysis.CharArraySet; //导入方法依赖的package包/类
private static CharArraySet resolveNamedWords(Collection<String> words, Map<String, Set<?>> namedWords, boolean ignoreCase) {
    if (namedWords == null) {
        return new CharArraySet(words, ignoreCase);
    }
    CharArraySet setWords = new CharArraySet(words.size(), ignoreCase);
    for (String word : words) {
        if (namedWords.containsKey(word)) {
            setWords.addAll(namedWords.get(word));
        } else {
            setWords.add(word);
        }
    }
    return setWords;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:15,代码来源:Analysis.java

示例2: getStopWordList

import org.apache.lucene.analysis.CharArraySet; //导入方法依赖的package包/类
public static CharArraySet getStopWordList(Version luceneVersion, String stopwordList, boolean ignoreCase) {
    String[] terms = stopwordList.split(",");
    CharArraySet stopwordSet = new CharArraySet(luceneVersion, terms.length, ignoreCase);
    for (String term : terms) {
        stopwordSet.add(term);
    }
    return CharArraySet.unmodifiableSet(stopwordSet);
}
 
开发者ID:asimihsan,项目名称:handytrowel,代码行数:9,代码来源:StopwordAnnotator.java

示例3: remove

import org.apache.lucene.analysis.CharArraySet; //导入方法依赖的package包/类
private CharArraySet remove(char[] charArray) {
    CharArraySet newSet = new CharArraySet(5, false);
    for (Object aCurrentSetToCheck : currentSetToCheck) {
        char[] phrase = (char[]) aCurrentSetToCheck;
        if (!isEqualTo(phrase, charArray) && startsWith(phrase, charArray) || endsWith(charArray, phrase)) {
            newSet.add(phrase);
        }
    }
    return newSet;
}
 
开发者ID:jprante,项目名称:elasticsearch-plugin-bundle,代码行数:11,代码来源:AutoPhrasingTokenFilter.java

示例4: processDoc

import org.apache.lucene.analysis.CharArraySet; //导入方法依赖的package包/类
private void processDoc(int docid, String fieldName, Set<String> selector,
                        CharArraySet set) throws IOException {
  Terms terms = searcher.getIndexReader().getTermVector(docid, fieldName);
  if (terms != null) {
    TermsEnum te = terms.iterator();
    BytesRef bytes = te.next();

    while (bytes != null) {
      set.add(bytes);
      bytes = te.next();
    }
  } else if (analyzer != null) {
    Document document = searcher.doc(docid, selector);
    IndexableField[] fields = document.getFields(fieldName);
    if (fields == null) {
      return;
    }
    for (IndexableField field : fields) {
      String s = field.stringValue();
      //is this possible
      if (s == null) {
        continue;
      }
      processFieldEntry(fieldName, s, set);
    }

  } else {
    throw new IllegalArgumentException("The field must have a term vector or the analyzer must" +
        " not be null.");
  }
}
 
开发者ID:tballison,项目名称:lucene-addons,代码行数:32,代码来源:QueryToCorpusContraster.java

示例5: processFieldEntry

import org.apache.lucene.analysis.CharArraySet; //导入方法依赖的package包/类
private void processFieldEntry(String fieldName, String s, CharArraySet set) throws IOException {
  TokenStream ts = analyzer.tokenStream(fieldName, s);
  CharTermAttribute cattr = ts.getAttribute(CharTermAttribute.class);
  ts.reset();
  while (ts.incrementToken()) {
    set.add(cattr.toString());
  }
  ts.end();
  ts.close();
}
 
开发者ID:tballison,项目名称:lucene-addons,代码行数:11,代码来源:QueryToCorpusContraster.java


注:本文中的org.apache.lucene.analysis.CharArraySet.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。