From d01d7fa09f404fb1eb99f06d0301bea5b81ca272 Mon Sep 17 00:00:00 2001 From: Jun Ohtani Date: Mon, 8 Dec 2014 00:23:44 +0900 Subject: [PATCH] Analysis: Use PreBuiltXXXFactory Closes #34 --- .../analysis/KuromojiIndicesAnalysis.java | 12 +++--- .../KurumojiCharFilterFactoryFactory.java | 38 ------------------- .../KurumojiTokenFilterFactoryFactory.java | 38 ------------------- .../KurumojiTokenizerFactoryFactory.java | 38 ------------------- 4 files changed, 6 insertions(+), 120 deletions(-) delete mode 100644 src/main/java/org/elasticsearch/indices/analysis/KurumojiCharFilterFactoryFactory.java delete mode 100644 src/main/java/org/elasticsearch/indices/analysis/KurumojiTokenFilterFactoryFactory.java delete mode 100644 src/main/java/org/elasticsearch/indices/analysis/KurumojiTokenizerFactoryFactory.java diff --git a/src/main/java/org/elasticsearch/indices/analysis/KuromojiIndicesAnalysis.java b/src/main/java/org/elasticsearch/indices/analysis/KuromojiIndicesAnalysis.java index 222b6657ff7..ba5d58073a3 100644 --- a/src/main/java/org/elasticsearch/indices/analysis/KuromojiIndicesAnalysis.java +++ b/src/main/java/org/elasticsearch/indices/analysis/KuromojiIndicesAnalysis.java @@ -46,7 +46,7 @@ public class KuromojiIndicesAnalysis extends AbstractComponent { new JapaneseAnalyzer())); indicesAnalysisService.charFilterFactories().put("kuromoji_iteration_mark", - new KurumojiCharFilterFactoryFactory(new CharFilterFactory() { + new PreBuiltCharFilterFactoryFactory(new CharFilterFactory() { @Override public String name() { return "kuromoji_iteration_mark"; @@ -61,7 +61,7 @@ public class KuromojiIndicesAnalysis extends AbstractComponent { })); indicesAnalysisService.tokenizerFactories().put("kuromoji_tokenizer", - new KurumojiTokenizerFactoryFactory(new TokenizerFactory() { + new PreBuiltTokenizerFactoryFactory(new TokenizerFactory() { @Override public String name() { return "kuromoji_tokenizer"; @@ -74,7 +74,7 @@ public class KuromojiIndicesAnalysis extends AbstractComponent { })); indicesAnalysisService.tokenFilterFactories().put("kuromoji_baseform", - new KurumojiTokenFilterFactoryFactory(new TokenFilterFactory() { + new PreBuiltTokenFilterFactoryFactory(new TokenFilterFactory() { @Override public String name() { return "kuromoji_baseform"; @@ -88,7 +88,7 @@ public class KuromojiIndicesAnalysis extends AbstractComponent { indicesAnalysisService.tokenFilterFactories().put( "kuromoji_part_of_speech", - new KurumojiTokenFilterFactoryFactory(new TokenFilterFactory() { + new PreBuiltTokenFilterFactoryFactory(new TokenFilterFactory() { @Override public String name() { return "kuromoji_part_of_speech"; @@ -103,7 +103,7 @@ public class KuromojiIndicesAnalysis extends AbstractComponent { indicesAnalysisService.tokenFilterFactories().put( "kuromoji_readingform", - new KurumojiTokenFilterFactoryFactory(new TokenFilterFactory() { + new PreBuiltTokenFilterFactoryFactory(new TokenFilterFactory() { @Override public String name() { return "kuromoji_readingform"; @@ -116,7 +116,7 @@ public class KuromojiIndicesAnalysis extends AbstractComponent { })); indicesAnalysisService.tokenFilterFactories().put("kuromoji_stemmer", - new KurumojiTokenFilterFactoryFactory(new TokenFilterFactory() { + new PreBuiltTokenFilterFactoryFactory(new TokenFilterFactory() { @Override public String name() { return "kuromoji_stemmer"; diff --git a/src/main/java/org/elasticsearch/indices/analysis/KurumojiCharFilterFactoryFactory.java b/src/main/java/org/elasticsearch/indices/analysis/KurumojiCharFilterFactoryFactory.java deleted file mode 100644 index 3737d81f1a7..00000000000 --- a/src/main/java/org/elasticsearch/indices/analysis/KurumojiCharFilterFactoryFactory.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to Elasticsearch (the "Author") under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. Author 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.indices.analysis; - -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.index.analysis.CharFilterFactory; -import org.elasticsearch.index.analysis.PreBuiltCharFilterFactoryFactory; - -public class KurumojiCharFilterFactoryFactory extends PreBuiltCharFilterFactoryFactory { - private final CharFilterFactory charFilterFactory; - - public KurumojiCharFilterFactoryFactory(CharFilterFactory charFilterFactory) { - super(charFilterFactory); - this.charFilterFactory = charFilterFactory; - } - - @Override - public CharFilterFactory create(String name, Settings settings) { - return charFilterFactory; - } -} diff --git a/src/main/java/org/elasticsearch/indices/analysis/KurumojiTokenFilterFactoryFactory.java b/src/main/java/org/elasticsearch/indices/analysis/KurumojiTokenFilterFactoryFactory.java deleted file mode 100644 index 2efaa91baa0..00000000000 --- a/src/main/java/org/elasticsearch/indices/analysis/KurumojiTokenFilterFactoryFactory.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to Elasticsearch (the "Author") under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. Author 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.indices.analysis; - -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.index.analysis.PreBuiltTokenFilterFactoryFactory; -import org.elasticsearch.index.analysis.TokenFilterFactory; - -public class KurumojiTokenFilterFactoryFactory extends PreBuiltTokenFilterFactoryFactory { - private final TokenFilterFactory tokenFilterFactory; - - public KurumojiTokenFilterFactoryFactory(TokenFilterFactory tokenFilterFactory) { - super(tokenFilterFactory); - this.tokenFilterFactory = tokenFilterFactory; - } - - @Override - public TokenFilterFactory create(String name, Settings settings) { - return tokenFilterFactory; - } -} diff --git a/src/main/java/org/elasticsearch/indices/analysis/KurumojiTokenizerFactoryFactory.java b/src/main/java/org/elasticsearch/indices/analysis/KurumojiTokenizerFactoryFactory.java deleted file mode 100644 index 6e5525762ff..00000000000 --- a/src/main/java/org/elasticsearch/indices/analysis/KurumojiTokenizerFactoryFactory.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to Elasticsearch (the "Author") under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. Author 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.indices.analysis; - -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.index.analysis.PreBuiltTokenizerFactoryFactory; -import org.elasticsearch.index.analysis.TokenizerFactory; - -public class KurumojiTokenizerFactoryFactory extends PreBuiltTokenizerFactoryFactory { - private final TokenizerFactory tokenizerFactory; - - public KurumojiTokenizerFactoryFactory(TokenizerFactory tokenizerFactory) { - super(tokenizerFactory); - this.tokenizerFactory = tokenizerFactory; - } - - @Override - public TokenizerFactory create(String name, Settings settings) { - return tokenizerFactory; - } -}