You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2010/07/29 17:09:31 UTC

[Solr Wiki] Update of "CSVResponseWriter" by YonikSeeley

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The "CSVResponseWriter" page has been changed by YonikSeeley.
http://wiki.apache.org/solr/CSVResponseWriter

--------------------------------------------------

New page:
== CSV output format ==
<!> [[Solr3.1]]

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 [[http://wiki.apache.org/solr/UpdateCSV|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 as 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