use of org.apache.commons.codec.language.Metaphone in project lucene-solr by apache.
the class TestPhoneticFilter method testEmptyTerm.
public void testEmptyTerm() throws IOException {
Encoder[] encoders = new Encoder[] { new Metaphone(), new DoubleMetaphone(), new Soundex(), new RefinedSoundex(), new Caverphone2() };
for (final Encoder e : encoders) {
Analyzer a = new Analyzer() {
@Override
protected TokenStreamComponents createComponents(String fieldName) {
Tokenizer tokenizer = new KeywordTokenizer();
return new TokenStreamComponents(tokenizer, new PhoneticFilter(tokenizer, e, random().nextBoolean()));
}
};
checkOneTerm(a, "", "");
a.close();
}
}
use of org.apache.commons.codec.language.Metaphone in project lucene-solr by apache.
the class TestPhoneticFilterFactory method testFactoryReflection.
/**
* Case: Reflection
*/
public void testFactoryReflection() throws IOException {
Map<String, String> args = new HashMap<>();
args.put(PhoneticFilterFactory.ENCODER, "org.apache.commons.codec.language.Metaphone");
PhoneticFilterFactory factory = new PhoneticFilterFactory(args);
factory.inform(new ClasspathResourceLoader(factory.getClass()));
assertTrue(factory.getEncoder() instanceof Metaphone);
// default
assertTrue(factory.inject);
}
Aggregations