當前位置: 首頁>>代碼示例>>Java>>正文


Java Version.LUCENE_CURRENT屬性代碼示例

本文整理匯總了Java中org.apache.lucene.util.Version.LUCENE_CURRENT屬性的典型用法代碼示例。如果您正苦於以下問題:Java Version.LUCENE_CURRENT屬性的具體用法?Java Version.LUCENE_CURRENT怎麽用?Java Version.LUCENE_CURRENT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.apache.lucene.util.Version的用法示例。


在下文中一共展示了Version.LUCENE_CURRENT屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: inform

@Override
public void inform(ResourceLoader loader) throws IOException {
  final TokenizerFactory factory = tokenizerFactory == null ? null : loadTokenizerFactory(loader, tokenizerFactory);
  
  Analyzer analyzer = new Analyzer() {
    @Override
    protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
      Tokenizer tokenizer = factory == null ? new WhitespaceTokenizer(Version.LUCENE_CURRENT, reader) : factory.create(reader);
      TokenStream stream = ignoreCase ? new LowerCaseFilter(Version.LUCENE_CURRENT, tokenizer) : tokenizer;
      return new TokenStreamComponents(tokenizer, stream);
    }
  };

  try {
    String formatClass = format;
    if (format == null || format.equals("solr")) {
      formatClass = SolrSynonymParser.class.getName();
    } else if (format.equals("wordnet")) {
      formatClass = WordnetSynonymParser.class.getName();
    }
    // TODO: expose dedup as a parameter?
    map = loadSynonyms(loader, formatClass, true, analyzer);
  } catch (ParseException e) {
    throw new IOException("Error parsing synonyms file:", e);
  }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:26,代碼來源:FSTSynonymFilterFactory.java

示例2: add

/**
 * @param singleMatch  List<String>, the sequence of strings to match
 * @param replacement  List<Token> the list of tokens to use on a match
 * @param includeOrig  sets a flag on this mapping signaling the generation of matched tokens in addition to the replacement tokens
 * @param mergeExisting merge the replacement tokens with any other mappings that exist
 */
public void add(List<String> singleMatch, List<Token> replacement, boolean includeOrig, boolean mergeExisting) {
  SlowSynonymMap currMap = this;
  for (String str : singleMatch) {
    if (currMap.submap==null) {
      // for now hardcode at 4.0, as its what the old code did.
      // would be nice to fix, but shouldn't store a version in each submap!!!
      currMap.submap = new CharArrayMap<>(Version.LUCENE_CURRENT, 1, ignoreCase());
    }

    SlowSynonymMap map = currMap.submap.get(str);
    if (map==null) {
      map = new SlowSynonymMap();
      map.flags |= flags & IGNORE_CASE;
      currMap.submap.put(str, map);
    }

    currMap = map;
  }

  if (currMap.synonyms != null && !mergeExisting) {
    throw new IllegalArgumentException("SynonymFilter: there is already a mapping for " + singleMatch);
  }
  List<Token> superset = currMap.synonyms==null ? replacement :
        mergeTokens(Arrays.asList(currMap.synonyms), replacement);
  currMap.synonyms = superset.toArray(new Token[superset.size()]);
  if (includeOrig) currMap.flags |= INCLUDE_ORIG;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:33,代碼來源:SlowSynonymMap.java

示例3: ChineseFilter

public ChineseFilter(TokenStream in) {
    super(in);

    stopTable = new CharArraySet(Version.LUCENE_CURRENT, Arrays.asList(STOP_WORDS), false);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:5,代碼來源:ChineseFilter.java


注:本文中的org.apache.lucene.util.Version.LUCENE_CURRENT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。