I'm not getting the expected results from my Analyzer
and would like to test the tokenization process.
The answer this question: How to use a Lucene Analyzer to tokenize a String?
List<String> result = new ArrayList<String>();
TokenStream stream = analyzer.tokenStream(field, new StringReader(keywords));
try {
while(stream.incrementToken()) {
result.add(stream.getAttribute(TermAttribute.class).term());
}
}
catch(IOException e) {
// not thrown b/c we're using a string reader...
}
return result;
Uses the TermAttribute
to extract the tokens from the stream. The problem is that TermAttribute
is no longer in Lucene 6.
What has it been replaced by?
What would the equivalent be with Lucene 6.6.0?