Sure. An analyzer is basically a factory object that creates a TokenStream object used to tokenized the text. A typical analyzer implementation creates the TokenStream by creating a standard tokenizer and combining it with a series of filters, each perform a different processing of the token stream.
Here is a sample customized analyzer contributed by Joanne Proton:
public class MyAnalyzer extends Analyzer { /* * An array containing some common words that * are not usually useful for searching. */ private static final String[] STOP_WORDS = { "a" , "and" , "are" , "as" , "at" , "be" , "but" , "by" , "for" , "if" , "in" , "into" , "is" , "it" , "no" , "not" , "of" , "on" , "or" , "s" , "such" , "t" , "that" , "the" , "their" , "then" , "there" , "these" , "they" , "this" , "to" , "was" , "will" , "with" }; /* * Stop table */ final static private Hashtable stopTable = StopFilter.makeStopTable(STOP_WORDS); /* * Create a token stream for this analyzer. */ public final TokenStream tokenStream(final Reader reader) { TokenStream result = new StandardTokenizer(reader); result = new StandardFilter(result); result = new LowerCaseFilter(result); result = new StopFilter(result, stopTable); result = new PorterStemFilter(result); return result; } Trackback: http://tb.donews.net/TrackBack.aspx?PostId=123043