lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Woolf, Ross" <>
Subject Not getting any highlighter results when using wildcards
Date Wed, 24 Feb 2010 23:40:07 GMT
When I use a WildcardQuery with the highlighter, I don't get any fragments back, I get null
returned to strBetText.  If I just use a term query then it works.  

TokenStream tokenStream = TokenSources.getTokenStream(indexReader, docId, strFieldName);
QueryScorer scorer = new QueryScorer(query, strFieldName);
Fragmenter fragmenter = new SimpleSpanFragmenter(scorer);
SimpleHTMLFormatter formatter = new SimpleHTMLFormatter("[", "]");
Highlighter highlighter = new Highlighter(formatter, scorer);
String strBestText = null;
strBestText = highlighter.getBestFragment(tokenStream, strText);

In the Lucene In Action book it mentions that if you are using wildcard that you need to call
rewrite on query before using it.  I have tried doing this but in my debugger I still see
the query with the wildcard and it does not look as if it has rewritten it.  

Is there a problem using wildcards in the highlighter, or am I not using rewrite on my query
correctly? (why would code inside the highlighter not call the rewrite automatically?).  

Any help would be appreciated.

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

View raw message