CSVResponseWriter

Solr recently received another small, but worth mentioning functionality – another response format available in standard distribution – CSV response format. I decided to write a short note about it.

After compiling and building an example we need to uncomment the following line (in solrconfig.xml):

After this we only need to start and index some data. I used the data from an example file (hd.xml).

As the functionality is really simple i decided to only test if it works 😉 After running a query like q=*:*&fl=id,name,popularity&wt=csv i got the following data:

The same query (of course, without the wt=csv parameter) will generate the following xml file:

The end

If You want a quick look at the data in the index without unnecessary details and You do not want to play with XML parsing than CSV format seems to be quite reasonable alternative. Note, however, that the new ResponseWriter will not return information like number of documents matching the query or query time. But, if you do not need such information, then You should look at the CSVResponseWriter.

Leave a Reply

Your email address will not be published. Required fields are marked *