Highlighter returning incomplete field text 2007-02-09 - By Fred Eaker
Back Is there a limit to how many characters a Highlighter or NullFragmenter will return?
I have indexed an entire HTML document (145kb). When I use the highlighter with a NullFragmenter, the getBestFragment and getBestFragments methods return the text of the field up to 51316 characters.
I have tried indexing other HTML documents as well, but get the same results.
If I change the Highlighter's Encoder to DefaultEncoder, I get more characters, but not the entire field.
Here is some code:
Highlighter highlighter = new Highlighter(new SimpleHTMLFormatter(), new DefaultEncoder(), new QueryScorer(query));
highlighter.setTextFragmenter(new NullFragmenter());
TokenStream tokenStream = LuceneUtils.getAnalyzer().tokenStream( fieldName, new StringReader(hit.get(fieldName)));
String highlightedHit = highlighter.getBestFragment(tokenStream, hit.get(fieldName));
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ To unsubscribe, e-mail: java-user-unsubscribe@(protected) For additional commands, e-mail: java-user-help@(protected)
|
|