Simple question : How to make Lucene's StandardAnalyzer
not to remove stop words when analyzing my sentence ?
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());
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
For Lucene 6.0.0, use
StandardAnalyzer analyzer = StandardAnalyzer(CharArraySet.EMPTY_SET);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With