Reputation: 8118
Simple question : How to make Lucene's StandardAnalyzer
not to remove stop words when analyzing my sentence ?
Upvotes: 10
Views: 8083
Reputation: 47
For Lucene 6.0.0, use
StandardAnalyzer analyzer = StandardAnalyzer(CharArraySet.EMPTY_SET);
Upvotes: 3
Reputation: 4316
Update: the answer is version-dependent. For Lucene 4.0, use:
Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_40, CharArraySet.EMPTY_SET);
Note that the StandardAnalyzer
is not in the lucene-core jar, but in lucene-analyzers-common-4.0.0.jar
Upvotes: 7
Reputation: 20621
The answer is version-dependent. For Lucene 3.0.3 (current), you need to construct the StandardAnalyzer with an empty set of stop words, using something like this:
Analyzer ana = new StandardAnalyzer(LUCENE_30, Collections.emptySet());
Upvotes: 12