Reputation: 23
Hie, I m using java and solr as search engine to export the data into csv format.The sequence of step which i m following --Based on the input parameter i m making a query Let say Q. --After that i m creating a java Process p to execute that query. --The Response which i got from solr server i need to push it into a csv file at any location.
enter code here
String Q = "http://pcam-stg-app-03:9999/solr/brm-royalty/select?
q=VENDOR_NAME:\"SOME_NAME\"&f1=vendor_name,vendor_id&wt=csv";
Process p = Runtime.getRuntime().exec(Q);
p.getInputStream();
This stream i need to write in csv file any idea ?
Upvotes: 0
Views: 1006
Reputation: 15789
Beware of just paging through the query to get all results...that is an antipattern. If the query returned many docs, and you want all of them, you need to use cursorMark.
Upvotes: 1
Reputation: 105
A combination of the CSV response writer and SOLRJ to page through all of the results sending it to something like apache commons fileutils:
FileUtils.writeStringToFile(new File(output.csv), outputLine ("line.separator"), true);
Would be quiet quick to knock up in Java.
Upvotes: 0