本文整理汇总了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);
}
示例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);
}
示例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);
}
示例4: create
import org.apache.lucene.analysis.standard.UAX29URLEmailTokenizer; //导入方法依赖的package包/类
@Override
public Tokenizer create() {
UAX29URLEmailTokenizer tokenizer = new UAX29URLEmailTokenizer();
tokenizer.setMaxTokenLength(maxTokenLength);
return tokenizer;
}
示例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;
}