Karvas
Karvas

Reputation: 39

How to build my own "common word" filter with Lucene

I know that Lucene uses a stop word(common) filter for searching and I also know that for this job the Standard Analyzer or EnglishAnalyzer are responsible. What about, if I want to add my own common words to the analyzer filter? How could I add words like computer, internet, system, etc.

Upvotes: 1

Views: 176

Answers (1)

mindas
mindas

Reputation: 26733

I assume by "common words" you mean stopwords.

In order to add to standard list, just use another constructor of StandardAnalyzer (which accepts stopwords either as CharArraySet or Reader). To get standard stopword set, use StopAnalyzer.STOP_WORDS_SET.

Upvotes: 2

Related Questions