I am using Lucene search for search functionality in my project.

I am using the hightlighter class for making the searched key work highlight. This is working fine with noramal search.

But when i am performing wild card search the searched words are not getting hightlighted. i am pasting the code i used .

String _SearchKey="service*";
Analyzer analyzer = new SimpleAnalyzer();
QueryParser qp = new QueryParser("description", analyzer);
Query q = qp.parse(_SearchKey);
q = indexSearcher.rewrite(q);
ScoreDoc[] hits = indexSearcher.search(q, null, 1000).scoreDocs;
QueryScorer scorer = new QueryScorer(q, "description");
SimpleHTMLFormatter formatter = new SimpleHTMLFormatter(
"<font color=red><b>", "</b></font>");
Highlighter highlighter = new Highlighter(formatter, scorer);
for (int i = 0; i < hits.length; i++) {
Document doc = indexSearcher.doc(hits[i].doc);
String storedField = doc.get("description");
TokenStream stream = TokenSources.getAnyTokenStream (indexSearcher.getIndexReader(), hits[i].doc, "description", doc,analyzer);

String fragmentSeparator = "... ";
Fragmenter fragmenter = new SimpleSpanFragmenter(scorer);

String fragment = null;
try {
fragment = highlighter.getBestFragments(stream, storedField, 4,

} catch (Exception e) {

System.out.println("\n record #" + i + " : description is : "
+ doc.get("description") + " \t\tHighlighted Text :"
+ fragment);

The above code works fine while hightlighting the searched keywork in normal searhc. But when we do wild card search it is not working.

Any help on this