java - solr response in xml format -


i trying query solr using fields , want response in xml format. somehow not able response in xml format though have set parser xmlresponseparser. please check code , let me know wrong in here:

httpsolrserver  solr = new httpsolrserver(urlstring);  string querystring ="*:*";  solrquery query = new solrquery(querystring);  query.setquery(querystring);  query.setfields("type", "typestring"); query.addfilterquery("id");  query.setstart(0);  query.setrows(100);   solr.setparser(new xmlresponseparser());  queryresponse resp = solr.query(query); solrdocumentlist results = resp.getresults(); (int = 0; < results.size(); ++i) {     // need results in xml format     system.out.println(results.get(i)); } 

your code using solrj solr client. it's precisely done avoid dealing xml responses, , provides clean way solr results in code objects.

if want raw xml response, pick java http client, build request , send solr. you'll nice xml string...

note : can use clientutils.toquerystring(solrparams params, boolean xml) build query part of url


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -