use of org.apache.lucene.analysis.miscellaneous.PatternKeywordMarkerFilter in project lucene-solr by apache.
the class TestBeiderMorseFilter method testCustomAttribute.
public void testCustomAttribute() throws IOException {
TokenStream stream = new MockTokenizer(MockTokenizer.KEYWORD, false);
((Tokenizer) stream).setReader(new StringReader("D'Angelo"));
stream = new PatternKeywordMarkerFilter(stream, Pattern.compile(".*"));
stream = new BeiderMorseFilter(stream, new PhoneticEngine(NameType.GENERIC, RuleType.EXACT, true));
KeywordAttribute keyAtt = stream.addAttribute(KeywordAttribute.class);
stream.reset();
int i = 0;
while (stream.incrementToken()) {
assertTrue(keyAtt.isKeyword());
i++;
}
assertEquals(12, i);
stream.end();
stream.close();
}
Aggregations