lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Woolf, Ross" <Ross_Wo...@BMC.com>
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);
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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message