vigyasharma commented on a change in pull request #188:
URL: https://github.com/apache/lucene/pull/188#discussion_r688072266
##########
File path:
lucene/analysis/common/src/java/org/apache/lucene/analysis/commongrams/CommonGramsFilterFactory.java
##########
@@ -40,57 +36,28 @@
* @since 3.1
* @lucene.spi {@value #NAME}
*/
-public class CommonGramsFilterFactory extends TokenFilterFactory implements
ResourceLoaderAware {
+public class CommonGramsFilterFactory extends AbstractWordsFileFilterFactory {
/** SPI name */
public static final String NAME = "commonGrams";
- // TODO: shared base class for Stop/Keep/CommonGrams?
- private CharArraySet commonWords;
- private final String commonWordFiles;
- private final String format;
- private final boolean ignoreCase;
-
/** Creates a new CommonGramsFilterFactory */
public CommonGramsFilterFactory(Map<String, String> args) {
super(args);
- commonWordFiles = get(args, "words");
- format = get(args, "format");
- ignoreCase = getBoolean(args, "ignoreCase", false);
- if (!args.isEmpty()) {
- throw new IllegalArgumentException("Unknown parameters: " + args);
- }
}
/** Default ctor for compatibility with SPI */
public CommonGramsFilterFactory() {
throw defaultCtorException();
}
- @Override
- public void inform(ResourceLoader loader) throws IOException {
- if (commonWordFiles != null) {
- if ("snowball".equalsIgnoreCase(format)) {
- commonWords = getSnowballWordSet(loader, commonWordFiles, ignoreCase);
- } else {
- commonWords = getWordSet(loader, commonWordFiles, ignoreCase);
- }
- } else {
- commonWords = EnglishAnalyzer.ENGLISH_STOP_WORDS_SET;
Review comment:
That's right.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]