lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aigner, Thomas" <TAig...@WescoDist.com>
Subject question on filters
Date Tue, 05 Jul 2005 13:48:34 GMT
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


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message