Solr has been able to slurp in CSV for quite some time, and now I’ve finally got around to adding the ability to output query results in CSV also. The output format matches what the CSV loader can slurp.
Adding a simple wt=csv to a query request will cause the docs to be written in a CSV format that can be loaded into something like Excel.
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
CSV formats tend to vary, so there are a number of parameters that allow you to customize the output. For example setting csv.escape= and csv.separator=%09 (a URL-encoded tab character) will use a tab separator and backslash escaping to match the default CSV format that MySQL uses.
score id 0.98867977 IW-02 0.6523595 F8V7067-APL-KIT 0.2446348 MA147LL/A
Contact us today to learn how Lucidworks can help your team create powerful search and discovery applications for your customers and employees.