Hello, When I used the code with CJKAnalyzer and search English Text (Because the text is mixed with Korean and English ) sometimes the return Stirng is none. Others works well.
Is the code analyzer dependancy ? Thanks. Youngho ------- Test Code ( Just copy of the Book code ) --------- private static final String HIGH_LIGHT_OPEN = "<span class=\"highlight\">"; private static final String HIGH_LIGHT_CLOSE = "</span>"; public static String highLight(String value, String queryString) throws IOException { if (StringUtils.isEmpty(value) || StringUtils.isEmpty(queryString)) { return value; } TermQuery query = new TermQuery(new Term("h", queryString)); QueryScorer scorer = new QueryScorer(query); SimpleHTMLFormatter formatter = new SimpleHTMLFormatter(HIGH_LIGHT_OPEN, HIGH_LIGHT_CLOSE); Highlighter highlighter = new Highlighter(formatter, scorer); Fragmenter fragmenter = new SimpleFragmenter(50); highlighter.setTextFragmenter(fragmenter); TokenStream tokenStream = new CJKAnalyzer().tokenStream("h", new StringReader(value)); return highlighter.getBestFragments(tokenStream, value, 5, "..."); } ----- Original Message ----- From: "Erik Hatcher" <[EMAIL PROTECTED]> To: "Lucene Users List" <lucene-user@jakarta.apache.org> Sent: Thursday, January 27, 2005 8:37 AM Subject: Re: text highlighting > Also, there are some examples in the Lucene in Action source code (grab > it from http://www.lucenebook.com) (see HighlightIt.java). > > Erik > > On Jan 26, 2005, at 5:52 PM, markharw00d wrote: > > > Michael Celona wrote: > > > >> Does any have a working example of the highlighter class found in the > >> sandbox? > >> > >> > > There are several in the accompanying Junit test: > > http://cvs.apache.org/viewcvs.cgi/jakarta-lucene-sandbox/ > > contributions/highlighter/src/test/org/apache/lucene/search/highlight/ > > > > > > Cheers > > Mark > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED]