lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ahmet Arslan <>
Subject Re: Issue in custom filter
Date Fri, 15 Jan 2016 10:10:39 GMT
Hi Simitha,

Please try below :

  final String term = charTermAttr.toString();
  final String s = convertedTerm = Converter.convert(term);

    // If not changed, don't waste the time adjusting the token.    if ((s != null) &&


On Friday, January 15, 2016 11:59 AM, Smitha Rajiv <> wrote:


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:

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

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,

View raw message