List of usage examples for org.apache.lucene.util AttributeFactory createAttributeInstance
public abstract AttributeImpl createAttributeInstance(Class<? extends Attribute> attClass) throws UndeclaredThrowableException;
From source file:com.o19s.RegexPathHierarchyTokenizer.java
License:Apache License
public RegexPathHierarchyTokenizer(AttributeFactory factory, Reader input, int bufferSize, String delimiter, int depthPrefixNumChars) { super(factory, input); if (bufferSize < 0) { throw new IllegalArgumentException("bufferSize cannot be negative"); }/*from w w w . j a va2 s . c om*/ if (depthPrefixNumChars > 0) { termAttFormatter = new Formatter(termAtt); zeroPaddingString = "%0" + depthPrefixNumChars + "d"; } termBuffer = new StringBuilder(bufferSize); termAtt.resizeBuffer(bufferSize); this.delimiter = Pattern.compile(delimiter); this.depthPrefixNumChars = depthPrefixNumChars; keyWordTokenizerTermAtt = (CharTermAttribute) factory.createAttributeInstance(CharTermAttribute.class); matcher = this.delimiter.matcher(keyWordTokenizerTermAtt); }