Hi

I have a requirement such that while indexing if tokens contains numbers,
it needs to be converted into corresponding words.

e.g : term1 part 2 assignments -> termone part two assignments.

I have created a custom filter with following code:

@Override
public boolean incrementToken() throws IOException {
if (!input.incrementToken())
return false;
char[] buffer = charTermAttr.buffer();
String newTerm = new String(buffer);
convertedTerm = Converter.convert(newTerm);
charTermAttr.setEmpty();
charTermAttr.copyBuffer(convertedTerm.toCharArray(), 0,

 convertedTerm.length());
return true;

}
But its given weird results when i analyze.

After applying the custom filter i am getting the result as
termone partone twoartone assignments.

It looks like the buffer length which i am setting for the first token is
not getting reset while picking up the next token.I have a feeling that
somewhere i am messing up with the offsets.

Could you please help me in this.

Thanks & Regards,
Smitha

Reply via email to