mocobeta commented on code in PR #906: URL: https://github.com/apache/lucene/pull/906#discussion_r876990252
########## lucene/analysis/common/src/java/org/apache/lucene/analysis/fa/PersianAnalyzer.java: ########## @@ -88,30 +88,43 @@ private static class DefaultSetHolder { } private final CharArraySet stemExclusionSet; + private final boolean useStemming; /** Builds an analyzer with the default stop words: {@link #DEFAULT_STOPWORD_FILE}. */ public PersianAnalyzer() { this(DefaultSetHolder.DEFAULT_STOP_SET); } /** - * Builds an analyzer with the given stop words + * Builds an analyzer with the default stop words: {@link #DEFAULT_STOPWORD_FILE} + * + * @param useStemming whether or not to enable stemming + */ + public PersianAnalyzer(boolean useStemming) { + this(DefaultSetHolder.DEFAULT_STOP_SET, useStemming, CharArraySet.EMPTY_SET); + } + + /** + * Builds an analyzer with the given stop words and no stemming * * @param stopwords a stopword set */ public PersianAnalyzer(CharArraySet stopwords) { - this(stopwords, CharArraySet.EMPTY_SET); + this(stopwords, false, CharArraySet.EMPTY_SET); } /** - * Builds an analyzer with the given stop word. If a none-empty stem exclusion set is provided - * this analyzer will add a {@link SetKeywordMarkerFilter} before {@link PersianStemFilter}. + * Builds an analyzer with the given stop word. If a non-empty stem exclusion set is provided this + * analyzer will add a {@link SetKeywordMarkerFilter} before {@link PersianStemFilter}. * * @param stopwords a stopword set + * @param useStemming whether or not to enable stemming * @param stemExclusionSet a set of terms not to be stemmed */ - public PersianAnalyzer(CharArraySet stopwords, CharArraySet stemExclusionSet) { + public PersianAnalyzer( + CharArraySet stopwords, boolean useStemming, CharArraySet stemExclusionSet) { Review Comment: I'd suppose when `stemExclusionSet` is set `useStemming` flag is always set to true, so I think the three-args constructor can be internal-use only. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org