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


Java UAX29URLEmailTokenizer.setMaxTokenLength方法代码示例

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


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

示例1: testLongEMAILatomText

import org.apache.lucene.analysis.standard.UAX29URLEmailTokenizer; //导入方法依赖的package包/类
public void testLongEMAILatomText() throws Exception {
  // EMAILatomText = [A-Za-z0-9!#$%&'*+-/=?\^_`{|}~]
  char[] emailAtomChars
      = "!#$%&'*+,-./0123456789=?ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`abcdefghijklmnopqrstuvwxyz{|}~".toCharArray();
  StringBuilder builder = new StringBuilder();
  int numChars = TestUtil.nextInt(random(), 100 * 1024, 3 * 1024 * 1024);
  for (int i = 0 ; i < numChars ; ++i) {
    builder.append(emailAtomChars[random().nextInt(emailAtomChars.length)]);
  }
  int tokenCount = 0;
  String text = builder.toString();
  UAX29URLEmailTokenizer ts = new UAX29URLEmailTokenizer(new StringReader(text));
  ts.reset();
  while (ts.incrementToken()) {
    tokenCount++;
  }
  ts.end();
  ts.close();
  assertTrue(tokenCount > 0);

  tokenCount = 0;
  int newBufferSize = TestUtil.nextInt(random(), 200, 8192);
  ts.setMaxTokenLength(newBufferSize);
  ts.setReader(new StringReader(text));
  ts.reset();
  while (ts.incrementToken()) {
    tokenCount++;
  }
  ts.end();
  ts.close();
  assertTrue(tokenCount > 0);
}
 
开发者ID:europeana,项目名称:search,代码行数:33,代码来源:TestUAX29URLEmailTokenizer.java

示例2: createComponents

import org.apache.lucene.analysis.standard.UAX29URLEmailTokenizer; //导入方法依赖的package包/类
@Override
protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
  UAX29URLEmailTokenizer tokenizer = new UAX29URLEmailTokenizer(newAttributeFactory(), reader);
  tokenizer.setMaxTokenLength(Integer.MAX_VALUE);  // Tokenize arbitrary length URLs
  TokenFilter filter = new URLFilter(tokenizer);
  return new TokenStreamComponents(tokenizer, filter);
}
 
开发者ID:europeana,项目名称:search,代码行数:8,代码来源:TestUAX29URLEmailTokenizer.java

示例3: createComponents

import org.apache.lucene.analysis.standard.UAX29URLEmailTokenizer; //导入方法依赖的package包/类
@Override
protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
  UAX29URLEmailTokenizer tokenizer = new UAX29URLEmailTokenizer(TEST_VERSION_CURRENT, reader);
  tokenizer.setMaxTokenLength(Integer.MAX_VALUE);  // Tokenize arbitrary length URLs
  TokenFilter filter = new URLFilter(tokenizer);
  return new TokenStreamComponents(tokenizer, filter);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:8,代码来源:TestUAX29URLEmailTokenizer.java

示例4: create

import org.apache.lucene.analysis.standard.UAX29URLEmailTokenizer; //导入方法依赖的package包/类
@Override
public Tokenizer create() {
    UAX29URLEmailTokenizer tokenizer = new UAX29URLEmailTokenizer();
    tokenizer.setMaxTokenLength(maxTokenLength);
    return tokenizer;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:7,代码来源:UAX29URLEmailTokenizerFactory.java

示例5: create

import org.apache.lucene.analysis.standard.UAX29URLEmailTokenizer; //导入方法依赖的package包/类
@Override
public UAX29URLEmailTokenizer create(Reader input) {
  UAX29URLEmailTokenizer tokenizer = new UAX29URLEmailTokenizer(luceneMatchVersion, input); 
  tokenizer.setMaxTokenLength(maxTokenLength);
  return tokenizer;
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:7,代码来源:UAX29URLEmailTokenizerFactory.java


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