lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shinichiro Abe (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LUCENE-6200) Highlighter sometime went wrong
Date Wed, 04 Feb 2015 09:00:57 GMT

    [ https://issues.apache.org/jira/browse/LUCENE-6200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14304806#comment-14304806
] 

Shinichiro Abe commented on LUCENE-6200:
----------------------------------------

Perhaps the same as LUCENE-1489.

> Highlighter sometime went wrong
> -------------------------------
>
>                 Key: LUCENE-6200
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6200
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: modules/highlighter
>    Affects Versions: 4.10.2
>            Reporter: thihy
>              Labels: highlighter
>
> I have write a test case for this. I expect "<B>游戏</B>是<B>游戏</B>",
but get "<B>游戏是游戏</B>"
> {code:java}
> 	public static void main(String[] args) throws IOException,
> 			InvalidTokenOffsetsException {
> 		String text = "游戏是游戏";
> 		String query = "游戏";
> 		CJKAnalyzer analyzer = new CJKAnalyzer();
> 		Scorer fragmentScorer = new QueryScorer(new TermQuery(new Term("field",
> 				query)));
> 		Highlighter highlighter = new Highlighter(fragmentScorer);
> 		String fragment = highlighter.getBestFragment(
> 				analyzer.tokenStream("field", text), text);
> 		analyzer.close();
> 		System.out.println(fragment); // println: <B>游戏是游戏</B>
> 	}
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message