CSV output format
The CSVResponseWriter can write the list of documents in a response in CSV format. Other information that would normally be included in a response, such as facet information, is excluded.
Multi-valued fields are also supported, and the output of this CSV format is compatible with Solr's CSV update format.
Example
Add wt=csv to any query that returns a list of documents.
http://localhost:8983/solr/select?q=ipod&fl=id,cat,name,popularity,price,score&wt=csv
id,cat,name,popularity,price,score IW-02,"electronics,connector",iPod & iPod Mini USB 2.0 Cable,1,11.5,0.98867977 F8V7067-APL-KIT,"electronics,connector",Belkin Mobile Power Cord for iPod w/ Dock,1,19.95,0.6523595 MA147LL/A,"electronics,music",Apple 60 GB iPod with Video Playback Black,10,399.0,0.2446348
Parameters
There are multiple parameters to control exactly what type of CSV is returned.
csv.encapsulator - Defaults to "
csv.escape - Defaults to none
csv.separator - Defaults to ,
csv.header - Defaults to true. If false, we skip printing out the column headers
csv.newline - Defaults to \n
csv.null - Defaults to a zero length string. This is used when a document has no value for a particular field.
csv.mv params are the defaults for how multi-valued fields are encoded. per-field overrides for these values can be done via f.myfield.csv.separator=|
csv.mv.encapsulator - Defaults to none
csv.mv.escape - Defaults to \
csv.mv.separator - Defaults to csv.separator