lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maxSchlein <>
Subject help customfilter with incrementToken() and AttributeSource APIs
Date Thu, 24 Dec 2009 17:10:05 GMT

In the current version of lucene, 3.0 the following methods are no longer
   - Token.setTermText() 
   - Token.termText().  

The newer versions says to use, incrementToken() and AttributeSource APIs. 
But I cannot find much help using these in this way.  Any help again is
appreciated.  If anyone has a basic example, or can point me to something
useful that would be awesome.  Thanx.

Merry Christmas too.

public class CustomAnalyzer extends Analyzer
    public TokenStream tokenStream(final String fieldName, final Reader
        TokenStream ts = new WhitespaceTokenizer(reader);
        ts = new StopFilter(false, ts, StopAnalyzer.ENGLISH_STOP_WORDS_SET);
        ts = new LowerCaseFilter(ts);
        ts = new CustomFilter(ts);

        return ts;


public class CustomFilter extends TokenFilter
    protected CustomFilter(TokenStream tokenStream)
    public Token next(final Token reusableToken) throws IOException
        Token nextToken =;
        if(nextToken != null)
        return nextToken;
View this message in context:
Sent from the Lucene - Java Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message