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);
highlighter.setTextFragmenter(fragmenter);
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: [email protected]
For additional commands, e-mail: [email protected]