diff --git a/src/main/java/org/elasticsearch/index/analysis/IcuAnalysisBinderProcessor.java b/src/main/java/org/elasticsearch/index/analysis/IcuAnalysisBinderProcessor.java index dd4413a..c1d5223 100644 --- a/src/main/java/org/elasticsearch/index/analysis/IcuAnalysisBinderProcessor.java +++ b/src/main/java/org/elasticsearch/index/analysis/IcuAnalysisBinderProcessor.java @@ -1,8 +1,8 @@ /* - * Licensed to Elastic Search and Shay Banon under one + * Licensed to ElasticSearch and Shay Banon under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. Elastic Search licenses this + * regarding copyright ownership. ElasticSearch licenses this * file to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at @@ -20,16 +20,17 @@ package org.elasticsearch.index.analysis; /** - * @author kimchy (shay.banon) */ public class IcuAnalysisBinderProcessor extends AnalysisModule.AnalysisBinderProcessor { - @Override public void processTokenizers(TokenizersBindings tokenizersBindings) { + @Override + public void processTokenizers(TokenizersBindings tokenizersBindings) { tokenizersBindings.processTokenizer("icuTokenizer", IcuTokenizerFactory.class); tokenizersBindings.processTokenizer("icu_tokenizer", IcuTokenizerFactory.class); } - - @Override public void processTokenFilters(TokenFiltersBindings tokenFiltersBindings) { + + @Override + public void processTokenFilters(TokenFiltersBindings tokenFiltersBindings) { tokenFiltersBindings.processTokenFilter("icuNormalizer", IcuNormalizerTokenFilterFactory.class); tokenFiltersBindings.processTokenFilter("icu_normalizer", IcuNormalizerTokenFilterFactory.class); diff --git a/src/main/java/org/elasticsearch/index/analysis/IcuTokenizerFactory.java b/src/main/java/org/elasticsearch/index/analysis/IcuTokenizerFactory.java index 736ba20..440fbb4 100644 --- a/src/main/java/org/elasticsearch/index/analysis/IcuTokenizerFactory.java +++ b/src/main/java/org/elasticsearch/index/analysis/IcuTokenizerFactory.java @@ -1,8 +1,8 @@ /* - * Licensed to Elastic Search and Shay Banon under one + * Licensed to ElasticSearch and Shay Banon under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. Elastic Search licenses this + * regarding copyright ownership. ElasticSearch licenses this * file to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at @@ -18,28 +18,28 @@ */ package org.elasticsearch.index.analysis; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.inject.assistedinject.Assisted; -import java.io.Reader; import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.analysis.icu.segmentation.ICUTokenizer; +import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.inject.assistedinject.Assisted; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.Index; import org.elasticsearch.index.settings.IndexSettings; +import java.io.Reader; + /** - * - * @author joerg */ public class IcuTokenizerFactory extends AbstractTokenizerFactory { - @Inject public IcuTokenizerFactory(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) { + @Inject + public IcuTokenizerFactory(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) { super(index, indexSettings, name, settings); } - + @Override public Tokenizer create(Reader reader) { return new ICUTokenizer(reader); } - + } diff --git a/src/main/java/org/elasticsearch/index/analysis/IcuTransformTokenFilterFactory.java b/src/main/java/org/elasticsearch/index/analysis/IcuTransformTokenFilterFactory.java index 1f34d02..525feda 100644 --- a/src/main/java/org/elasticsearch/index/analysis/IcuTransformTokenFilterFactory.java +++ b/src/main/java/org/elasticsearch/index/analysis/IcuTransformTokenFilterFactory.java @@ -1,8 +1,8 @@ /* - * Licensed to Elastic Search and Shay Banon under one + * Licensed to ElasticSearch and Shay Banon under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. Elastic Search licenses this + * regarding copyright ownership. ElasticSearch licenses this * file to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at @@ -19,11 +19,11 @@ package org.elasticsearch.index.analysis; +import com.ibm.icu.text.Transliterator; import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.icu.ICUTransformFilter; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.assistedinject.Assisted; -import com.ibm.icu.text.Transliterator; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.Index; import org.elasticsearch.index.settings.IndexSettings; @@ -38,15 +38,17 @@ public class IcuTransformTokenFilterFactory extends AbstractTokenFilterFactory { private final int dir; private final Transliterator transliterator; - @Inject public IcuTransformTokenFilterFactory(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) { + @Inject + public IcuTransformTokenFilterFactory(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) { super(index, indexSettings, name, settings); this.id = settings.get("id", "Null"); - String s = settings.get("dir", "forward"); + String s = settings.get("dir", "forward"); this.dir = "forward".equals(s) ? Transliterator.FORWARD : Transliterator.REVERSE; this.transliterator = Transliterator.getInstance(id, dir); } - @Override public TokenStream create(TokenStream tokenStream) { + @Override + public TokenStream create(TokenStream tokenStream) { return new ICUTransformFilter(tokenStream, transliterator); } } \ No newline at end of file diff --git a/src/test/java/org/elasticsearch/index/analysis/SimpleIcuAnalysisTests.java b/src/test/java/org/elasticsearch/index/analysis/SimpleIcuAnalysisTests.java index f28f131..a3e55a7 100644 --- a/src/test/java/org/elasticsearch/index/analysis/SimpleIcuAnalysisTests.java +++ b/src/test/java/org/elasticsearch/index/analysis/SimpleIcuAnalysisTests.java @@ -1,8 +1,8 @@ /* - * Licensed to Elastic Search and Shay Banon under one + * Licensed to ElasticSearch and Shay Banon under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. Elastic Search licenses this + * regarding copyright ownership. ElasticSearch licenses this * file to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at @@ -32,15 +32,15 @@ import org.hamcrest.MatcherAssert; import org.testng.annotations.Test; -import static org.elasticsearch.common.settings.ImmutableSettings.Builder.*; -import static org.hamcrest.Matchers.*; +import static org.elasticsearch.common.settings.ImmutableSettings.Builder.EMPTY_SETTINGS; +import static org.hamcrest.Matchers.instanceOf; /** - * @author kimchy (shay.banon) */ public class SimpleIcuAnalysisTests { - @Test public void testDefaultsIcuAnalysis() { + @Test + public void testDefaultsIcuAnalysis() { Index index = new Index("test"); Injector parentInjector = new ModulesBuilder().add(new SettingsModule(EMPTY_SETTINGS), new EnvironmentModule(new Environment(EMPTY_SETTINGS)), new IndicesAnalysisModule()).createInjector(); @@ -54,16 +54,16 @@ public class SimpleIcuAnalysisTests { TokenizerFactory tokenizerFactory = analysisService.tokenizer("icu_tokenizer"); MatcherAssert.assertThat(tokenizerFactory, instanceOf(IcuTokenizerFactory.class)); - + TokenFilterFactory filterFactory = analysisService.tokenFilter("icu_normalizer"); MatcherAssert.assertThat(filterFactory, instanceOf(IcuNormalizerTokenFilterFactory.class)); - + filterFactory = analysisService.tokenFilter("icu_folding"); MatcherAssert.assertThat(filterFactory, instanceOf(IcuFoldingTokenFilterFactory.class)); filterFactory = analysisService.tokenFilter("icu_collation"); MatcherAssert.assertThat(filterFactory, instanceOf(IcuCollationTokenFilterFactory.class)); - + filterFactory = analysisService.tokenFilter("icu_transform"); MatcherAssert.assertThat(filterFactory, instanceOf(IcuTransformTokenFilterFactory.class)); }