(10/06/01 6:45), Gerald wrote:
I was looking at solr-386 and thought I would try to create a custom
highlighter for something I was doing.
I created a class that looks something like this:
public class CustomOutputHighlighter extends DefaultSolrHighlighter {
@Override
public NamedList doHighlighting(DocList docs, Query query,
SolrQueryRequest req, String[] defaultFields) throws IOException {
NamedList highlightedValues = super.doHighlighting(docs,
query, req, defaultFields);
// do more stuff here
return highlightedValues
}
}
and have replaced the<highlighting> line in my solrconfig xml so that it
looks something like this:
<highlighting class="com.xxxxxxx.solr.highlight.CustomOutputHighlighter">
and left all the existing default highlighting parameters as-is
The code compiles with no problem, and should simply perform the normal
highlighting (since all I am doing is calling the original doHighlighting
code and returning the results). However, when I start Solr, I get an NPE
error:
Try to put a constructor that has an argument SolrCore:
public CustomOutputHighlighter(SolrCore core){
super(core);
}
Koji
--
http://www.rondhuit.com/en/