Hi all,

      I am creating a punctuation filter to filter certain punctuation
out of the token stream.  I am getting a "The field t.termText is not
visible" error.  I'm not sure what I would need to include to make this
property visible (I am still new to Lucene and Java for that matter).  I
copied to code from the LowerCaseFilter that Lucene uses and slightly
modified it.

 

 

import java.io.IOException;

import org.apache.lucene.analysis.TokenStream;

import org.apache.lucene.analysis.TokenFilter;

import org.apache.lucene.analysis.Token;

 

public class PunctuationFilter extends TokenFilter {

  public PunctuationFilter(TokenStream in) {

    super(in);

  }

 

  public Token next() throws IOException {

      

    Token t = input.next();

 

    if (t == null)

      return null;

 

    t.termText = t.termText.replaceAll("-","");

    t.termText = t.termText.replaceAll("/","");

    

    return t;

  }

}

 

 

Thanks all,

Tom

Reply via email to