parent
901a6e9437
commit
f44ef93d38
4
pom.xml
4
pom.xml
|
@ -6,7 +6,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.elasticsearch</groupId>
|
||||
<artifactId>elasticsearch-analysis-phonetic</artifactId>
|
||||
<version>1.9.0-SNAPSHOT</version>
|
||||
<version>2.0.0.RC1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<description>Phonetic Analysis for ElasticSearch</description>
|
||||
<inceptionYear>2009</inceptionYear>
|
||||
|
@ -31,7 +31,7 @@
|
|||
</parent>
|
||||
|
||||
<properties>
|
||||
<elasticsearch.version>0.90.8</elasticsearch.version>
|
||||
<elasticsearch.version>1.0.0.RC1-SNAPSHOT</elasticsearch.version>
|
||||
<lucene.version>4.6.0</lucene.version>
|
||||
<tests.jvms>1</tests.jvms>
|
||||
<tests.shuffle>true</tests.shuffle>
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.apache.lucene.analysis.TokenStream;
|
|||
import org.apache.lucene.analysis.phonetic.BeiderMorseFilter;
|
||||
import org.apache.lucene.analysis.phonetic.DoubleMetaphoneFilter;
|
||||
import org.apache.lucene.analysis.phonetic.PhoneticFilter;
|
||||
import org.elasticsearch.ElasticSearchIllegalArgumentException;
|
||||
import org.elasticsearch.ElasticsearchIllegalArgumentException;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.inject.assistedinject.Assisted;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -90,7 +90,7 @@ public class PhoneticTokenFilterFactory extends AbstractTokenFilterFactory {
|
|||
} else if ("exact".equalsIgnoreCase(ruleType)) {
|
||||
ruletype = RuleType.EXACT;
|
||||
} else {
|
||||
throw new ElasticSearchIllegalArgumentException("No matching rule type [" + ruleType + "] for beider morse encoder");
|
||||
throw new ElasticsearchIllegalArgumentException("No matching rule type [" + ruleType + "] for beider morse encoder");
|
||||
}
|
||||
String nameType = settings.get("name_type", "generic");
|
||||
if ("GENERIC".equalsIgnoreCase(nameType)) {
|
||||
|
@ -107,7 +107,7 @@ public class PhoneticTokenFilterFactory extends AbstractTokenFilterFactory {
|
|||
} else if ("nysiis".equalsIgnoreCase(encodername)) {
|
||||
this.encoder = new Nysiis();
|
||||
} else {
|
||||
throw new ElasticSearchIllegalArgumentException("unknown encoder [" + encodername + "] for phonetic token filter");
|
||||
throw new ElasticsearchIllegalArgumentException("unknown encoder [" + encodername + "] for phonetic token filter");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,6 +127,6 @@ public class PhoneticTokenFilterFactory extends AbstractTokenFilterFactory {
|
|||
} else {
|
||||
return new PhoneticFilter(tokenStream, encoder, !replace);
|
||||
}
|
||||
throw new ElasticSearchIllegalArgumentException("encoder error");
|
||||
throw new ElasticsearchIllegalArgumentException("encoder error");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,10 +45,7 @@ public class SimplePhoneticAnalysisTests extends ElasticsearchTestCase {
|
|||
public void testPhoneticTokenFilterFactory() {
|
||||
Settings settings = settingsBuilder().loadFromClasspath("org/elasticsearch/index/analysis/phonetic-1.yml").build();
|
||||
AnalysisService analysisService = testSimpleConfiguration(settings);
|
||||
TokenFilterFactory standardfilterFactory = analysisService.tokenFilter("standard");
|
||||
System.err.println("standard filterfactory = " + standardfilterFactory);
|
||||
TokenFilterFactory filterFactory = analysisService.tokenFilter("phonetic");
|
||||
System.err.println("filterfactory = " + filterFactory);
|
||||
MatcherAssert.assertThat(filterFactory, instanceOf(PhoneticTokenFilterFactory.class));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue