1 - The standard stop word set is StopAnalyzer.ENGLISH_STOPWORD_SET
. It is unmodifiable, so you should just copy the code as a starting point:
final List<String> stopWords = Arrays.asList(
"a", "an", "and", "are", "as", "at", "be", "but", "by",
"for", "if", "in", "into", "is", "it",
"no", "not", "of", "on", "or", "such",
"that", "the", "their", "then", "there", "these",
"they", "this", "to", "was", "will", "with"
);
final CharArraySet stopSet = new CharArraySet(Version.LUCENE_CURRENT,
stopWords, false);
2 - A stop filter isn't the right approach for this. I suspect, you are probably looking for something like LetterTokenizer
, which will define tokens as consecutive strings of letter, thus eliminating any non-letter characters.