From fc23bfd8f2fc66b32bec0ab292c2cb9a50ef1783 Mon Sep 17 00:00:00 2001 From: David Pilato Date: Thu, 8 Aug 2013 15:43:00 +0200 Subject: [PATCH] Update to Elasticsearch 0.90.3 / Lucene 4.4.0 Closes #6. --- README.md | 4 ++-- pom.xml | 4 ++-- .../KuromojiPartOfSpeechFilterFactory.java | 5 ++--- .../analysis/KuromojiIndicesAnalysis.java | 16 ++++++---------- .../index/analysis/kuromoji_analysis.json | 3 +-- 5 files changed, 13 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index b1598ef98de..a34aa1078b1 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,9 @@ In order to install the plugin, simply run: `bin/plugin -install elasticsearch/e ---------------------------------------------------- | Kuromoji Analysis Plugin | ElasticSearch | ---------------------------------------------------- - | 1.5.0-SNAPSHOT (master) | 0.90.1 -> master | + | 1.5.0-SNAPSHOT (master) | 0.90.3 -> master | ---------------------------------------------------- - | 1.4.0 | 0.90.1 | + | 1.4.0 | 0.90.1 -> 0.90.2 | ---------------------------------------------------- | 1.3.0 | 0.90.0 | ---------------------------------------------------- diff --git a/pom.xml b/pom.xml index fcd502c51b8..3631f291f70 100644 --- a/pom.xml +++ b/pom.xml @@ -31,8 +31,8 @@ - 0.90.1 - 4.3.0 + 0.90.3 + 4.4.0 diff --git a/src/main/java/org/elasticsearch/index/analysis/KuromojiPartOfSpeechFilterFactory.java b/src/main/java/org/elasticsearch/index/analysis/KuromojiPartOfSpeechFilterFactory.java index 2497595dce5..0459eec739c 100644 --- a/src/main/java/org/elasticsearch/index/analysis/KuromojiPartOfSpeechFilterFactory.java +++ b/src/main/java/org/elasticsearch/index/analysis/KuromojiPartOfSpeechFilterFactory.java @@ -21,6 +21,7 @@ package org.elasticsearch.index.analysis; import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.ja.JapanesePartOfSpeechStopFilter; +import org.apache.lucene.util.Version; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.assistedinject.Assisted; import org.elasticsearch.common.settings.Settings; @@ -34,7 +35,6 @@ import java.util.Set; public class KuromojiPartOfSpeechFilterFactory extends AbstractTokenFilterFactory { - private final boolean enablePositionIncrements; private final Set stopTags = new HashSet(); @Inject @@ -44,12 +44,11 @@ public class KuromojiPartOfSpeechFilterFactory extends AbstractTokenFilterFactor if (wordList != null) { stopTags.addAll(wordList); } - this.enablePositionIncrements = settings.getAsBoolean("enable_position_increments", true); } @Override public TokenStream create(TokenStream tokenStream) { - return new JapanesePartOfSpeechStopFilter(enablePositionIncrements, tokenStream, stopTags); + return new JapanesePartOfSpeechStopFilter(Version.LUCENE_44, tokenStream, stopTags); } } diff --git a/src/main/java/org/elasticsearch/indices/analysis/KuromojiIndicesAnalysis.java b/src/main/java/org/elasticsearch/indices/analysis/KuromojiIndicesAnalysis.java index 06d6e16b309..613c8b3b232 100644 --- a/src/main/java/org/elasticsearch/indices/analysis/KuromojiIndicesAnalysis.java +++ b/src/main/java/org/elasticsearch/indices/analysis/KuromojiIndicesAnalysis.java @@ -18,17 +18,11 @@ */ package org.elasticsearch.indices.analysis; -import java.io.Reader; - import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.Tokenizer; -import org.apache.lucene.analysis.ja.JapaneseAnalyzer; -import org.apache.lucene.analysis.ja.JapaneseBaseFormFilter; -import org.apache.lucene.analysis.ja.JapaneseKatakanaStemFilter; -import org.apache.lucene.analysis.ja.JapanesePartOfSpeechStopFilter; -import org.apache.lucene.analysis.ja.JapaneseReadingFormFilter; -import org.apache.lucene.analysis.ja.JapaneseTokenizer; +import org.apache.lucene.analysis.ja.*; import org.apache.lucene.analysis.ja.JapaneseTokenizer.Mode; +import org.apache.lucene.util.Version; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; @@ -37,6 +31,8 @@ import org.elasticsearch.index.analysis.PreBuiltTokenizerFactoryFactory; import org.elasticsearch.index.analysis.TokenFilterFactory; import org.elasticsearch.index.analysis.TokenizerFactory; +import java.io.Reader; + /** * Registers indices level analysis components so, if not explicitly configured, * will be shared among all indices. @@ -85,7 +81,7 @@ public class KuromojiIndicesAnalysis extends AbstractComponent { @Override public TokenStream create(TokenStream tokenStream) { - return new JapanesePartOfSpeechStopFilter(false, + return new JapanesePartOfSpeechStopFilter(Version.LUCENE_44, tokenStream, JapaneseAnalyzer .getDefaultStopTags()); } @@ -118,4 +114,4 @@ public class KuromojiIndicesAnalysis extends AbstractComponent { } })); } -} \ No newline at end of file +} diff --git a/src/test/java/org/elasticsearch/index/analysis/kuromoji_analysis.json b/src/test/java/org/elasticsearch/index/analysis/kuromoji_analysis.json index 46731d60db5..b0960850e85 100644 --- a/src/test/java/org/elasticsearch/index/analysis/kuromoji_analysis.json +++ b/src/test/java/org/elasticsearch/index/analysis/kuromoji_analysis.json @@ -8,7 +8,6 @@ }, "kuromoji_pos" : { "type": "kuromoji_part_of_speech", - "enable_position_increment" : "false", "stoptags" : ["# verb-main:", "動詞-自立"] }, "kuromoji_ks" : { @@ -34,4 +33,4 @@ } } -} \ No newline at end of file +}