@Override public void transform(SolrDocument doc, int docid) { if (context != null && context.query != null) { try { Explanation exp = context.searcher.explain(context.query, docid); if (style == Style.nl) { doc.setField(name, SolrPluginUtils.explanationToNamedList(exp)); } else if (style == Style.html) { doc.setField(name, exp.toHtml()); } else { doc.setField(name, exp.toString()); } } catch (IOException e) { e.printStackTrace(); } } }