From a725d287bc74a8bb5f4e042ea9c68bd84044888b Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Tue, 21 Sep 2021 10:40:23 -0700 Subject: [PATCH] Fix split package in analysis-icu plugin (#78037) The analysis-icu plugin reuses server package names for analysis and mappers. This commit moves the plugin implementation to use a single package name, o.e.p.analysis.icu --- plugins/analysis-icu/build.gradle | 14 -------------- .../plugin/analysis/icu/AnalysisICUPlugin.java | 8 -------- .../analysis/icu}/ICUCollationKeyFilter.java | 2 +- .../icu}/ICUCollationKeywordFieldMapper.java | 12 ++++++++++-- .../analysis/icu}/IcuAnalyzerProvider.java | 3 ++- .../icu}/IcuCollationTokenFilterFactory.java | 3 ++- .../icu}/IcuFoldingTokenFilterFactory.java | 4 +++- .../icu}/IcuNormalizerCharFilterFactory.java | 4 +++- .../icu}/IcuNormalizerTokenFilterFactory.java | 4 +++- .../analysis/icu}/IcuTokenizerFactory.java | 3 ++- .../icu}/IcuTransformTokenFilterFactory.java | 4 +++- .../analysis/icu}/IndexableBinaryStringTools.java | 2 +- .../analysis/icu}/AnalysisICUFactoryTests.java | 7 ++++++- .../analysis/icu}/CollationFieldTypeTests.java | 8 +++++--- .../icu}/ICUCollationKeywordFieldMapperTests.java | 9 ++++++++- .../icu}/ICUCollationKeywordFieldTypeTests.java | 6 +++++- .../analysis/icu}/IcuAnalyzerTests.java | 3 ++- .../analysis/icu}/IcuTokenizerFactoryTests.java | 6 +++--- .../icu}/IndexableBinaryStringToolsTests.java | 3 ++- .../analysis/icu}/SimpleIcuAnalysisTests.java | 11 ++++++++++- .../icu}/SimpleIcuCollationTokenFilterTests.java | 3 ++- .../icu}/SimpleIcuNormalizerCharFilterTests.java | 3 ++- .../analysis/icu}/KeywordTokenizer.rbbi | 0 .../analysis/icu}/Latin-dont-break-on-hyphens.rbbi | 0 .../analysis/icu}/icu_analysis.json | 0 25 files changed, 75 insertions(+), 47 deletions(-) rename plugins/analysis-icu/src/main/java/org/elasticsearch/{index/analysis => plugin/analysis/icu}/ICUCollationKeyFilter.java (98%) rename plugins/analysis-icu/src/main/java/org/elasticsearch/{index/mapper => plugin/analysis/icu}/ICUCollationKeywordFieldMapper.java (97%) rename plugins/analysis-icu/src/main/java/org/elasticsearch/{index/analysis => plugin/analysis/icu}/IcuAnalyzerProvider.java (95%) rename plugins/analysis-icu/src/main/java/org/elasticsearch/{index/analysis => plugin/analysis/icu}/IcuCollationTokenFilterFactory.java (98%) rename plugins/analysis-icu/src/main/java/org/elasticsearch/{index/analysis => plugin/analysis/icu}/IcuFoldingTokenFilterFactory.java (91%) rename plugins/analysis-icu/src/main/java/org/elasticsearch/{index/analysis => plugin/analysis/icu}/IcuNormalizerCharFilterFactory.java (91%) rename plugins/analysis-icu/src/main/java/org/elasticsearch/{index/analysis => plugin/analysis/icu}/IcuNormalizerTokenFilterFactory.java (92%) rename plugins/analysis-icu/src/main/java/org/elasticsearch/{index/analysis => plugin/analysis/icu}/IcuTokenizerFactory.java (97%) rename plugins/analysis-icu/src/main/java/org/elasticsearch/{index/analysis => plugin/analysis/icu}/IcuTransformTokenFilterFactory.java (88%) rename plugins/analysis-icu/src/main/java/org/elasticsearch/{index/analysis => plugin/analysis/icu}/IndexableBinaryStringTools.java (99%) rename plugins/analysis-icu/src/test/java/org/elasticsearch/{index/analysis => plugin/analysis/icu}/AnalysisICUFactoryTests.java (79%) rename plugins/analysis-icu/src/test/java/org/elasticsearch/{index/mapper => plugin/analysis/icu}/CollationFieldTypeTests.java (95%) rename plugins/analysis-icu/src/test/java/org/elasticsearch/{index/mapper => plugin/analysis/icu}/ICUCollationKeywordFieldMapperTests.java (97%) rename plugins/analysis-icu/src/test/java/org/elasticsearch/{index/mapper => plugin/analysis/icu}/ICUCollationKeywordFieldTypeTests.java (86%) rename plugins/analysis-icu/src/test/java/org/elasticsearch/{index/analysis => plugin/analysis/icu}/IcuAnalyzerTests.java (96%) rename plugins/analysis-icu/src/test/java/org/elasticsearch/{index/analysis => plugin/analysis/icu}/IcuTokenizerFactoryTests.java (95%) rename plugins/analysis-icu/src/test/java/org/elasticsearch/{index/analysis => plugin/analysis/icu}/IndexableBinaryStringToolsTests.java (98%) rename plugins/analysis-icu/src/test/java/org/elasticsearch/{index/analysis => plugin/analysis/icu}/SimpleIcuAnalysisTests.java (73%) rename plugins/analysis-icu/src/test/java/org/elasticsearch/{index/analysis => plugin/analysis/icu}/SimpleIcuCollationTokenFilterTests.java (99%) rename plugins/analysis-icu/src/test/java/org/elasticsearch/{index/analysis => plugin/analysis/icu}/SimpleIcuNormalizerCharFilterTests.java (97%) rename plugins/analysis-icu/src/test/resources/org/elasticsearch/{index/analysis => plugin/analysis/icu}/KeywordTokenizer.rbbi (100%) rename plugins/analysis-icu/src/test/resources/org/elasticsearch/{index/analysis => plugin/analysis/icu}/Latin-dont-break-on-hyphens.rbbi (100%) rename plugins/analysis-icu/src/test/resources/org/elasticsearch/{index/analysis => plugin/analysis/icu}/icu_analysis.json (100%) diff --git a/plugins/analysis-icu/build.gradle b/plugins/analysis-icu/build.gradle index 7e07a9adc2fc0..46961cf7a0218 100644 --- a/plugins/analysis-icu/build.gradle +++ b/plugins/analysis-icu/build.gradle @@ -40,17 +40,3 @@ tasks.named("yamlRestTestV7CompatTest").configure { 'analysis_icu/10_basic/Normalization with deprecated unicodeSetFilter' // Cleanup versioned deprecations in analysis #41560 ].join(',') } - -tasks.named('splitPackagesAudit').configure { - // o.e.i.analysis is owned by server. Move these to an icu package - ignoreClasses 'org.elasticsearch.index.analysis.ICUCollationKeyFilter', - 'org.elasticsearch.index.analysis.IcuAnalyzerProvider', - 'org.elasticsearch.index.analysis.IcuCollationTokenFilterFactory', - 'org.elasticsearch.index.analysis.IcuFoldingTokenFilterFactory', - 'org.elasticsearch.index.analysis.IcuNormalizerCharFilterFactory', - 'org.elasticsearch.index.analysis.IcuNormalizerTokenFilterFactory', - 'org.elasticsearch.index.analysis.IcuTokenizerFactory', - 'org.elasticsearch.index.analysis.IcuTransformTokenFilterFactory', - 'org.elasticsearch.index.analysis.IndexableBinaryStringTools', - 'org.elasticsearch.index.mapper.ICUCollationKeywordFieldMapper' -} diff --git a/plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/AnalysisICUPlugin.java b/plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/AnalysisICUPlugin.java index 99a3be682b9aa..8ec4e7791333e 100644 --- a/plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/AnalysisICUPlugin.java +++ b/plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/AnalysisICUPlugin.java @@ -12,16 +12,8 @@ import org.elasticsearch.common.io.stream.NamedWriteableRegistry; import org.elasticsearch.index.analysis.AnalyzerProvider; import org.elasticsearch.index.analysis.CharFilterFactory; -import org.elasticsearch.index.analysis.IcuAnalyzerProvider; -import org.elasticsearch.index.analysis.IcuCollationTokenFilterFactory; -import org.elasticsearch.index.analysis.IcuFoldingTokenFilterFactory; -import org.elasticsearch.index.analysis.IcuNormalizerCharFilterFactory; -import org.elasticsearch.index.analysis.IcuNormalizerTokenFilterFactory; -import org.elasticsearch.index.analysis.IcuTokenizerFactory; -import org.elasticsearch.index.analysis.IcuTransformTokenFilterFactory; import org.elasticsearch.index.analysis.TokenFilterFactory; import org.elasticsearch.index.analysis.TokenizerFactory; -import org.elasticsearch.index.mapper.ICUCollationKeywordFieldMapper; import org.elasticsearch.index.mapper.Mapper; import org.elasticsearch.indices.analysis.AnalysisModule.AnalysisProvider; import org.elasticsearch.plugins.AnalysisPlugin; diff --git a/plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/ICUCollationKeyFilter.java b/plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/ICUCollationKeyFilter.java similarity index 98% rename from plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/ICUCollationKeyFilter.java rename to plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/ICUCollationKeyFilter.java index ab89157b923b0..1adc26e599a31 100644 --- a/plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/ICUCollationKeyFilter.java +++ b/plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/ICUCollationKeyFilter.java @@ -1,4 +1,4 @@ -package org.elasticsearch.index.analysis; +package org.elasticsearch.plugin.analysis.icu; /* @notice * Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/plugins/analysis-icu/src/main/java/org/elasticsearch/index/mapper/ICUCollationKeywordFieldMapper.java b/plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/ICUCollationKeywordFieldMapper.java similarity index 97% rename from plugins/analysis-icu/src/main/java/org/elasticsearch/index/mapper/ICUCollationKeywordFieldMapper.java rename to plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/ICUCollationKeywordFieldMapper.java index b2fadf6527a22..c40d0f32b3962 100644 --- a/plugins/analysis-icu/src/main/java/org/elasticsearch/index/mapper/ICUCollationKeywordFieldMapper.java +++ b/plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/ICUCollationKeywordFieldMapper.java @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -package org.elasticsearch.index.mapper; +package org.elasticsearch.plugin.analysis.icu; import com.ibm.icu.text.Collator; import com.ibm.icu.text.RawCollationKey; @@ -25,7 +25,15 @@ import org.elasticsearch.common.unit.Fuzziness; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.core.Nullable; -import org.elasticsearch.index.analysis.IndexableBinaryStringTools; +import org.elasticsearch.index.mapper.DocumentParserContext; +import org.elasticsearch.index.mapper.FieldMapper; +import org.elasticsearch.index.mapper.MappedFieldType; +import org.elasticsearch.index.mapper.MapperBuilderContext; +import org.elasticsearch.index.mapper.SourceValueFetcher; +import org.elasticsearch.index.mapper.StringFieldType; +import org.elasticsearch.index.mapper.TextParams; +import org.elasticsearch.index.mapper.TextSearchInfo; +import org.elasticsearch.index.mapper.ValueFetcher; import org.elasticsearch.index.fielddata.IndexFieldData; import org.elasticsearch.index.fielddata.plain.SortedSetOrdinalsIndexFieldData; import org.elasticsearch.index.query.SearchExecutionContext; diff --git a/plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuAnalyzerProvider.java b/plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/IcuAnalyzerProvider.java similarity index 95% rename from plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuAnalyzerProvider.java rename to plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/IcuAnalyzerProvider.java index 2a0e4521badbb..9635487a06178 100644 --- a/plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuAnalyzerProvider.java +++ b/plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/IcuAnalyzerProvider.java @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.plugin.analysis.icu; import com.ibm.icu.text.Normalizer2; import org.apache.lucene.analysis.Analyzer; @@ -17,6 +17,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; +import org.elasticsearch.index.analysis.AbstractIndexAnalyzerProvider; import java.io.Reader; diff --git a/plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuCollationTokenFilterFactory.java b/plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/IcuCollationTokenFilterFactory.java similarity index 98% rename from plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuCollationTokenFilterFactory.java rename to plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/IcuCollationTokenFilterFactory.java index df8a6136fe6fa..9cd9dc646652f 100644 --- a/plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuCollationTokenFilterFactory.java +++ b/plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/IcuCollationTokenFilterFactory.java @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.plugin.analysis.icu; import java.io.IOException; import java.nio.charset.Charset; @@ -22,6 +22,7 @@ import com.ibm.icu.text.Collator; import com.ibm.icu.text.RuleBasedCollator; import com.ibm.icu.util.ULocale; +import org.elasticsearch.index.analysis.AbstractTokenFilterFactory; /** * An ICU based collation token filter. There are two ways to configure collation: diff --git a/plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuFoldingTokenFilterFactory.java b/plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/IcuFoldingTokenFilterFactory.java similarity index 91% rename from plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuFoldingTokenFilterFactory.java rename to plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/IcuFoldingTokenFilterFactory.java index 50c584612ffce..bf25fec1c5dc6 100644 --- a/plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuFoldingTokenFilterFactory.java +++ b/plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/IcuFoldingTokenFilterFactory.java @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.plugin.analysis.icu; import com.ibm.icu.text.Normalizer2; @@ -15,6 +15,8 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; +import org.elasticsearch.index.analysis.AbstractTokenFilterFactory; +import org.elasticsearch.index.analysis.NormalizingTokenFilterFactory; /** diff --git a/plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuNormalizerCharFilterFactory.java b/plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/IcuNormalizerCharFilterFactory.java similarity index 91% rename from plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuNormalizerCharFilterFactory.java rename to plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/IcuNormalizerCharFilterFactory.java index 5d6f74c9f0031..86b7126bafecf 100644 --- a/plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuNormalizerCharFilterFactory.java +++ b/plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/IcuNormalizerCharFilterFactory.java @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.plugin.analysis.icu; import com.ibm.icu.text.Normalizer2; @@ -15,6 +15,8 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; +import org.elasticsearch.index.analysis.AbstractCharFilterFactory; +import org.elasticsearch.index.analysis.NormalizingCharFilterFactory; import java.io.Reader; diff --git a/plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuNormalizerTokenFilterFactory.java b/plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/IcuNormalizerTokenFilterFactory.java similarity index 92% rename from plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuNormalizerTokenFilterFactory.java rename to plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/IcuNormalizerTokenFilterFactory.java index d4da4be423bd4..d05edf00e7682 100644 --- a/plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuNormalizerTokenFilterFactory.java +++ b/plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/IcuNormalizerTokenFilterFactory.java @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.plugin.analysis.icu; import com.ibm.icu.text.FilteredNormalizer2; import com.ibm.icu.text.Normalizer2; @@ -15,6 +15,8 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; +import org.elasticsearch.index.analysis.AbstractTokenFilterFactory; +import org.elasticsearch.index.analysis.NormalizingTokenFilterFactory; /** diff --git a/plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuTokenizerFactory.java b/plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/IcuTokenizerFactory.java similarity index 97% rename from plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuTokenizerFactory.java rename to plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/IcuTokenizerFactory.java index 7395ed861d754..e4b07a578a72b 100644 --- a/plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuTokenizerFactory.java +++ b/plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/IcuTokenizerFactory.java @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.plugin.analysis.icu; import com.ibm.icu.lang.UCharacter; import com.ibm.icu.lang.UProperty; @@ -21,6 +21,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; +import org.elasticsearch.index.analysis.AbstractTokenizerFactory; import java.io.IOException; import java.nio.file.Files; diff --git a/plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuTransformTokenFilterFactory.java b/plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/IcuTransformTokenFilterFactory.java similarity index 88% rename from plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuTransformTokenFilterFactory.java rename to plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/IcuTransformTokenFilterFactory.java index 3535c088f712e..5a00849fe7fb6 100644 --- a/plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuTransformTokenFilterFactory.java +++ b/plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/IcuTransformTokenFilterFactory.java @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.plugin.analysis.icu; import com.ibm.icu.text.Transliterator; import org.apache.lucene.analysis.TokenStream; @@ -14,6 +14,8 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; +import org.elasticsearch.index.analysis.AbstractTokenFilterFactory; +import org.elasticsearch.index.analysis.NormalizingTokenFilterFactory; public class IcuTransformTokenFilterFactory extends AbstractTokenFilterFactory implements NormalizingTokenFilterFactory { diff --git a/plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IndexableBinaryStringTools.java b/plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/IndexableBinaryStringTools.java similarity index 99% rename from plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IndexableBinaryStringTools.java rename to plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/IndexableBinaryStringTools.java index 6d88e7084394d..41a213cc451a4 100644 --- a/plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IndexableBinaryStringTools.java +++ b/plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/IndexableBinaryStringTools.java @@ -1,4 +1,4 @@ -package org.elasticsearch.index.analysis; +package org.elasticsearch.plugin.analysis.icu; /* @notice * Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/AnalysisICUFactoryTests.java b/plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/AnalysisICUFactoryTests.java similarity index 79% rename from plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/AnalysisICUFactoryTests.java rename to plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/AnalysisICUFactoryTests.java index b6ed610bb4492..2747e8d138885 100644 --- a/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/AnalysisICUFactoryTests.java +++ b/plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/AnalysisICUFactoryTests.java @@ -6,8 +6,13 @@ * Side Public License, v 1. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.plugin.analysis.icu; +import org.elasticsearch.plugin.analysis.icu.IcuFoldingTokenFilterFactory; +import org.elasticsearch.plugin.analysis.icu.IcuNormalizerCharFilterFactory; +import org.elasticsearch.plugin.analysis.icu.IcuNormalizerTokenFilterFactory; +import org.elasticsearch.plugin.analysis.icu.IcuTokenizerFactory; +import org.elasticsearch.plugin.analysis.icu.IcuTransformTokenFilterFactory; import org.elasticsearch.indices.analysis.AnalysisFactoryTestCase; import org.elasticsearch.plugin.analysis.icu.AnalysisICUPlugin; diff --git a/plugins/analysis-icu/src/test/java/org/elasticsearch/index/mapper/CollationFieldTypeTests.java b/plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/CollationFieldTypeTests.java similarity index 95% rename from plugins/analysis-icu/src/test/java/org/elasticsearch/index/mapper/CollationFieldTypeTests.java rename to plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/CollationFieldTypeTests.java index 291be37abbe92..22c41b8635ef2 100644 --- a/plugins/analysis-icu/src/test/java/org/elasticsearch/index/mapper/CollationFieldTypeTests.java +++ b/plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/CollationFieldTypeTests.java @@ -5,7 +5,7 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ -package org.elasticsearch.index.mapper; +package org.elasticsearch.plugin.analysis.icu; import com.carrotsearch.randomizedtesting.generators.RandomStrings; import com.ibm.icu.text.Collator; @@ -18,7 +18,9 @@ import org.apache.lucene.util.BytesRef; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.unit.Fuzziness; -import org.elasticsearch.index.mapper.ICUCollationKeywordFieldMapper.CollationFieldType; +import org.elasticsearch.index.mapper.FieldTypeTestCase; +import org.elasticsearch.index.mapper.MappedFieldType; +import org.elasticsearch.plugin.analysis.icu.ICUCollationKeywordFieldMapper.CollationFieldType; import org.elasticsearch.index.mapper.MappedFieldType.Relation; import java.io.IOException; @@ -26,7 +28,7 @@ import java.util.Arrays; import java.util.List; -public class CollationFieldTypeTests extends FieldTypeTestCase{ +public class CollationFieldTypeTests extends FieldTypeTestCase { private static final Collator DEFAULT_COLLATOR = Collator.getInstance(ULocale.ROOT).freeze(); diff --git a/plugins/analysis-icu/src/test/java/org/elasticsearch/index/mapper/ICUCollationKeywordFieldMapperTests.java b/plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/ICUCollationKeywordFieldMapperTests.java similarity index 97% rename from plugins/analysis-icu/src/test/java/org/elasticsearch/index/mapper/ICUCollationKeywordFieldMapperTests.java rename to plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/ICUCollationKeywordFieldMapperTests.java index b4ddc8a2b9d79..82f6b1eaa9f22 100644 --- a/plugins/analysis-icu/src/test/java/org/elasticsearch/index/mapper/ICUCollationKeywordFieldMapperTests.java +++ b/plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/ICUCollationKeywordFieldMapperTests.java @@ -5,7 +5,7 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ -package org.elasticsearch.index.mapper; +package org.elasticsearch.plugin.analysis.icu; import com.ibm.icu.text.Collator; import com.ibm.icu.text.RawCollationKey; @@ -21,6 +21,13 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentType; +import org.elasticsearch.index.mapper.DocumentMapper; +import org.elasticsearch.index.mapper.MappedFieldType; +import org.elasticsearch.index.mapper.MapperParsingException; +import org.elasticsearch.index.mapper.MapperService; +import org.elasticsearch.index.mapper.MapperTestCase; +import org.elasticsearch.index.mapper.ParsedDocument; +import org.elasticsearch.index.mapper.SourceToParse; import org.elasticsearch.plugin.analysis.icu.AnalysisICUPlugin; import org.elasticsearch.plugins.Plugin; diff --git a/plugins/analysis-icu/src/test/java/org/elasticsearch/index/mapper/ICUCollationKeywordFieldTypeTests.java b/plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/ICUCollationKeywordFieldTypeTests.java similarity index 86% rename from plugins/analysis-icu/src/test/java/org/elasticsearch/index/mapper/ICUCollationKeywordFieldTypeTests.java rename to plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/ICUCollationKeywordFieldTypeTests.java index f38bff294f4e6..bf383666eb16d 100644 --- a/plugins/analysis-icu/src/test/java/org/elasticsearch/index/mapper/ICUCollationKeywordFieldTypeTests.java +++ b/plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/ICUCollationKeywordFieldTypeTests.java @@ -6,7 +6,11 @@ * Side Public License, v 1. */ -package org.elasticsearch.index.mapper; +package org.elasticsearch.plugin.analysis.icu; + +import org.elasticsearch.index.mapper.FieldTypeTestCase; +import org.elasticsearch.index.mapper.MapperBuilderContext; +import org.elasticsearch.plugin.analysis.icu.ICUCollationKeywordFieldMapper; import java.io.IOException; import java.util.List; diff --git a/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/IcuAnalyzerTests.java b/plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/IcuAnalyzerTests.java similarity index 96% rename from plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/IcuAnalyzerTests.java rename to plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/IcuAnalyzerTests.java index 185e49a8de3e7..9dd0de4334f1d 100644 --- a/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/IcuAnalyzerTests.java +++ b/plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/IcuAnalyzerTests.java @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.plugin.analysis.icu; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.BaseTokenStreamTestCase; @@ -14,6 +14,7 @@ import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.IndexSettings; +import org.elasticsearch.plugin.analysis.icu.IcuAnalyzerProvider; import org.elasticsearch.plugin.analysis.icu.AnalysisICUPlugin; import org.elasticsearch.test.IndexSettingsModule; diff --git a/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/IcuTokenizerFactoryTests.java b/plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/IcuTokenizerFactoryTests.java similarity index 95% rename from plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/IcuTokenizerFactoryTests.java rename to plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/IcuTokenizerFactoryTests.java index f04da32cb0cb6..818adfa127598 100644 --- a/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/IcuTokenizerFactoryTests.java +++ b/plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/IcuTokenizerFactoryTests.java @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.plugin.analysis.icu; import org.apache.lucene.analysis.icu.segmentation.ICUTokenizer; import org.elasticsearch.Version; @@ -14,7 +14,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.Index; -import org.elasticsearch.plugin.analysis.icu.AnalysisICUPlugin; +import org.elasticsearch.index.analysis.TokenizerFactory; import org.elasticsearch.test.ESTestCase; import java.io.IOException; @@ -81,7 +81,7 @@ private static TestAnalysis createTestAnalysis() throws IOException { Files.copy(keywords, config.resolve("KeywordTokenizer.rbbi")); Files.copy(latin, config.resolve("Latin-dont-break-on-hyphens.rbbi")); - String json = "/org/elasticsearch/index/analysis/icu_analysis.json"; + String json = "/org/elasticsearch/plugin/analysis/icu/icu_analysis.json"; Settings settings = Settings.builder() .loadFromStream(json, IcuTokenizerFactoryTests.class.getResourceAsStream(json), false) diff --git a/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/IndexableBinaryStringToolsTests.java b/plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/IndexableBinaryStringToolsTests.java similarity index 98% rename from plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/IndexableBinaryStringToolsTests.java rename to plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/IndexableBinaryStringToolsTests.java index 5f5fd6c1d6c75..df4b521b61da6 100644 --- a/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/IndexableBinaryStringToolsTests.java +++ b/plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/IndexableBinaryStringToolsTests.java @@ -1,4 +1,4 @@ -package org.elasticsearch.index.analysis; +package org.elasticsearch.plugin.analysis.icu; /* @notice * Licensed to the Apache Software Foundation (ASF) under one or more @@ -24,6 +24,7 @@ import org.apache.lucene.util.ArrayUtil; import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.util.TimeUnits; +import org.elasticsearch.plugin.analysis.icu.IndexableBinaryStringTools; import org.elasticsearch.test.junit.listeners.ReproduceInfoPrinter; import org.junit.BeforeClass; diff --git a/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/SimpleIcuAnalysisTests.java b/plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/SimpleIcuAnalysisTests.java similarity index 73% rename from plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/SimpleIcuAnalysisTests.java rename to plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/SimpleIcuAnalysisTests.java index 963fd33e51175..1fa2696c46d95 100644 --- a/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/SimpleIcuAnalysisTests.java +++ b/plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/SimpleIcuAnalysisTests.java @@ -6,10 +6,19 @@ * Side Public License, v 1. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.plugin.analysis.icu; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.Index; +import org.elasticsearch.index.analysis.CharFilterFactory; +import org.elasticsearch.index.analysis.TokenFilterFactory; +import org.elasticsearch.index.analysis.TokenizerFactory; +import org.elasticsearch.plugin.analysis.icu.IcuCollationTokenFilterFactory; +import org.elasticsearch.plugin.analysis.icu.IcuFoldingTokenFilterFactory; +import org.elasticsearch.plugin.analysis.icu.IcuNormalizerCharFilterFactory; +import org.elasticsearch.plugin.analysis.icu.IcuNormalizerTokenFilterFactory; +import org.elasticsearch.plugin.analysis.icu.IcuTokenizerFactory; +import org.elasticsearch.plugin.analysis.icu.IcuTransformTokenFilterFactory; import org.elasticsearch.plugin.analysis.icu.AnalysisICUPlugin; import org.elasticsearch.test.ESTestCase; diff --git a/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/SimpleIcuCollationTokenFilterTests.java b/plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/SimpleIcuCollationTokenFilterTests.java similarity index 99% rename from plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/SimpleIcuCollationTokenFilterTests.java rename to plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/SimpleIcuCollationTokenFilterTests.java index bf174de4eec1c..b3d4587940fc6 100644 --- a/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/SimpleIcuCollationTokenFilterTests.java +++ b/plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/SimpleIcuCollationTokenFilterTests.java @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.plugin.analysis.icu; import com.ibm.icu.text.Collator; import com.ibm.icu.text.RuleBasedCollator; @@ -17,6 +17,7 @@ import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.Index; +import org.elasticsearch.index.analysis.TokenFilterFactory; import org.elasticsearch.plugin.analysis.icu.AnalysisICUPlugin; import org.elasticsearch.test.ESTestCase; diff --git a/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/SimpleIcuNormalizerCharFilterTests.java b/plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/SimpleIcuNormalizerCharFilterTests.java similarity index 97% rename from plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/SimpleIcuNormalizerCharFilterTests.java rename to plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/SimpleIcuNormalizerCharFilterTests.java index 1d655105bae74..0b5f5c00198e2 100644 --- a/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/SimpleIcuNormalizerCharFilterTests.java +++ b/plugins/analysis-icu/src/test/java/org/elasticsearch/plugin/analysis/icu/SimpleIcuNormalizerCharFilterTests.java @@ -6,12 +6,13 @@ * Side Public License, v 1. */ -package org.elasticsearch.index.analysis; +package org.elasticsearch.plugin.analysis.icu; import com.ibm.icu.text.Normalizer2; import org.apache.lucene.analysis.CharFilter; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.Index; +import org.elasticsearch.index.analysis.CharFilterFactory; import org.elasticsearch.plugin.analysis.icu.AnalysisICUPlugin; import org.elasticsearch.test.ESTestCase; diff --git a/plugins/analysis-icu/src/test/resources/org/elasticsearch/index/analysis/KeywordTokenizer.rbbi b/plugins/analysis-icu/src/test/resources/org/elasticsearch/plugin/analysis/icu/KeywordTokenizer.rbbi similarity index 100% rename from plugins/analysis-icu/src/test/resources/org/elasticsearch/index/analysis/KeywordTokenizer.rbbi rename to plugins/analysis-icu/src/test/resources/org/elasticsearch/plugin/analysis/icu/KeywordTokenizer.rbbi diff --git a/plugins/analysis-icu/src/test/resources/org/elasticsearch/index/analysis/Latin-dont-break-on-hyphens.rbbi b/plugins/analysis-icu/src/test/resources/org/elasticsearch/plugin/analysis/icu/Latin-dont-break-on-hyphens.rbbi similarity index 100% rename from plugins/analysis-icu/src/test/resources/org/elasticsearch/index/analysis/Latin-dont-break-on-hyphens.rbbi rename to plugins/analysis-icu/src/test/resources/org/elasticsearch/plugin/analysis/icu/Latin-dont-break-on-hyphens.rbbi diff --git a/plugins/analysis-icu/src/test/resources/org/elasticsearch/index/analysis/icu_analysis.json b/plugins/analysis-icu/src/test/resources/org/elasticsearch/plugin/analysis/icu/icu_analysis.json similarity index 100% rename from plugins/analysis-icu/src/test/resources/org/elasticsearch/index/analysis/icu_analysis.json rename to plugins/analysis-icu/src/test/resources/org/elasticsearch/plugin/analysis/icu/icu_analysis.json