lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From faisalloe <>
Subject lucene highligher snowball analyzer highlight stem words
Date Mon, 15 Jun 2009 17:47:21 GMT

I am having the following method to highlight the terms.

 public static String getHighlighter(String colName, Highlighter
highlighter,IndexSearcher searcher,int id, Analyzer analyzer) throws
IOException {
		  String highlightTerm;
		  TokenStream tokenStream; 		
		  Document doc;
		  doc = searcher.doc(id);//document id
		  String text =  doc.get(colName);//doc.get("all_attributes");
		  //tokenStream =
TokenSources.getAnyTokenStream(searcher.getIndexReader(), id,
"all_attributes", analyzer);
		  tokenStream = TokenSources.getAnyTokenStream(searcher.getIndexReader(),
id, colName, new StandardAnalyzer());
		  highlightTerm = highlighter.getBestFragments(tokenStream, text, 1,
		  return highlightTerm;

i am using snowball analyzer to search stem words, i wonder stem words could
not be highlighted.

Please guide me how to proceed. if i use standranalyzer for  highlighting
terms it works fine.

View this message in context:
Sent from the Lucene - Java Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message