LUCENE-9259: Fix wrong NGramFilterFactory argument name for preserveOriginal option

This commit is contained in:
Tomoko Uchida 2020-03-10 01:25:14 +09:00
parent 03c2557681
commit c8dea5d77f
2 changed files with 5 additions and 4 deletions

View File

@ -1,5 +1,9 @@
# Apache Lucene Migration Guide
## NGramFilterFactory "keepShortTerm" option was fixed to "preserveOriginal" (LUCENE-9259) ##
The factory option name to output the original term was corrected in accordance with its Javadoc.
## o.a.l.misc.IndexMergeTool defaults changes (LUCENE-9206) ##
This command-line tool no longer forceMerges to a single segment. Instead, by

View File

@ -51,10 +51,7 @@ public class NGramFilterFactory extends TokenFilterFactory {
minGramSize = requireInt(args, "minGramSize");
maxGramSize = requireInt(args, "maxGramSize");
// First check for the old accidental used option name. It was the only way to configure preserve original
// for NGramFilter and ignoring it would unnecessary break existing configs.
boolean preserve = getBoolean(args, "keepShortTerm", NGramTokenFilter.DEFAULT_PRESERVE_ORIGINAL);
preserveOriginal = getBoolean(args, "preserveOriginal", preserve);
preserveOriginal = getBoolean(args, "preserveOriginal", NGramTokenFilter.DEFAULT_PRESERVE_ORIGINAL);
if (!args.isEmpty()) {
throw new IllegalArgumentException("Unknown parameters: " + args);
}