Your problem is in the last line. You create a chain of filters, and then short circuit it in the return statement by passing back new PorterStemFilter(source)
, which is a stem filter sitting directly on the tokenizer, rather than the filters earlier in the chain. This should be:
@Override
protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
Tokenizer source = new LetterTokenizer(Version.LUCENE_44, reader);
TokenStream filter = new LowerCaseFilter(Version.LUCENE_44, source);
filter = new StopFilter(Version.LUCENE_44, filter, stopWords);
filter = new PorterStemFilter(filter);
return new TokenStreamComponents(source, filter);
}