From c8dea5d77f7d05dc668be2148af9dd13c0bf98b2 Mon Sep 17 00:00:00 2001 From: Tomoko Uchida Date: Tue, 10 Mar 2020 01:25:14 +0900 Subject: [PATCH] LUCENE-9259: Fix wrong NGramFilterFactory argument name for preserveOriginal option --- lucene/MIGRATE.txt | 4 ++++ .../org/apache/lucene/analysis/ngram/NGramFilterFactory.java | 5 +---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lucene/MIGRATE.txt b/lucene/MIGRATE.txt index c019260e57c..b938c13d887 100644 --- a/lucene/MIGRATE.txt +++ b/lucene/MIGRATE.txt @@ -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 diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/NGramFilterFactory.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/NGramFilterFactory.java index 77e7c1bd55c..05d9f26315c 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/NGramFilterFactory.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/ngram/NGramFilterFactory.java @@ -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); }