Dear All, 

Until now we have used Solr from a servlet in which we built the
solr URL, and used response.sendRedirect(url) to send the query to
solr, and have it translate its XML results, through XSLT, to HTML.

We now want to do the XML/XSL translation process ourselves, 
and to accomplish that I no longer redirect my servlet to the solr
url, but use a CommonsHttpSolrServlet to which I pass the parameters
using ModifiableSolrParams:

CommonsHttpSolrServer server = new 
CommonsHttpSolrServer("http://localhost:8080/kannada/db";);
server.setParser(new XMLResponseParser());

ModifiableSolrParams params = new ModifiableSolrParams();
params.set("q", searchTerms);
params.set("q.op", combination);

QueryResponse solrResponse = null;
try{
    solrResponse = server.query(params);
} catch(Exception e) {
    System.out.println("Exception occured in SOLR");
}

When I so a System.out(solrResponse), I get:

{responseHeader={status=0,QTime=141,params={q=library,q.op=AND,wt=xml,version=2.2}},response={numFound=180,start=0,docs=[SolrDocument[{timestamp=Wed
 Jan 07 16:36:51 CET 2009, sum (...)

Because I used server.setParser(new XMLResponseParser()), I get the wt=xml 
parameter
in the responseHeader, but the format of the responseHeader is clearly no XML 
at all. I expect
Solr does output XML, but that the QueryResponse, when I print its contents, 
formats this as the
string above.

Is there any way to directly obtain Solr's XML output? 

Kind regards, and many thanks in advance, 

Maarten Buiter

Reply via email to