You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Mark Harwood (JIRA)" <ji...@apache.org> on 2006/07/13 21:33:30 UTC

[jira] Commented: (LUCENE-627) highlighter problems with overlapping tokens

    [ http://issues.apache.org/jira/browse/LUCENE-627?page=comments#action_12420915 ] 

Mark Harwood commented on LUCENE-627:
-------------------------------------

Works OK for me - just added this to the Highlighter's Junit test and all is well.
Something up with your analyzer?


	public void testOverlapAnalyzer2() throws Exception
	{
		HashMap synonyms = new HashMap();
		synonyms.put("ipod", "i,pod");
		Analyzer analyzer = new SynonymAnalyzer(synonyms);
		String srchkey = "ipod";

		String s = "I want an ipod";
		QueryParser parser=new QueryParser("text",new WhitespaceAnalyzer());
		Query query = parser.parse(srchkey);

		Highlighter highlighter = new Highlighter(new QueryScorer(query));
		TokenStream tokenStream =
			analyzer.tokenStream(null, new StringReader(s));
		// Get 3 best fragments and seperate with a "..."
		String result = highlighter.getBestFragments(tokenStream, s, 3, "...");
		String expectedResult="I want an <B>ipod</B>";
		assertEquals(expectedResult,result);
	}

> highlighter problems with overlapping tokens
> --------------------------------------------
>
>          Key: LUCENE-627
>          URL: http://issues.apache.org/jira/browse/LUCENE-627
>      Project: Lucene - Java
>         Type: Bug

>   Components: Other
>     Versions: 2.0.1
>     Reporter: Yonik Seeley

>
> The lucene highlighter has problems when tokens that overlap are generated.
> For example, if analysis of iPod generates the tokens "i", "pod", "ipod" (with pod and ipod in the same position),
> then the highlighter will output this as iipod, regardless of if any of those tokens are highlighted.
> Discovered via http://issues.apache.org/jira/browse/SOLR-24

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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