title: How to get Lucene explanation for a SolrDocument with Solrj?
body: <p>I'm searching an Solr index with SolrJ and trying to get the Lucene explanation for logging it for further use.</p>
  
  <p>The code goes like this:</p>
  
  <pre><code>    SolrServer server = new CommonsHttpSolrServer("solr_url");
      SolrQuery solrquery = new SolrQuery();
      solrquery.set("fl", "score, id"); // id is a String field
      solrquery.set("rows", "1000");
      solrquery.set("debugQuery", "on");
      solrquery.setQuery("query words here");
  
      try {
          QueryResponse response = server.query(solrquery);
          SolrDocumentList docs = response.getResults();
          Iterator&lt;SolrDocument&gt; dociterator = docs.iterator();
  
          while (dociterator.hasNext())
          {
              SolrDocument doc = dociterator.next();
              String id = (String) doc.getFirstValue(idfield);
              Float relevance = (Float) doc.getFirstValue("score");
              String explanation = ???;
          }
      } catch (SolrServerException e) {
          e.printStackTrace();
      }
  </code></pre>
  
  <p>I figured that response.getEplainMap() would contain a map with the value like response.getEplainMap().get(id) , but it seems that the explainmap contains only the key null with the value of the last found document.</p>
  
  <p>Any ideas how to get the correct explanation?</p>