December 2015
Intermediate to advanced
160 pages
2h 50m
English
At last, we'll now see how we can index CSV data in Solr using Content-Type: text/csv. A sample CSV file has been provided at %SOLR_EXAMPLES/Chapter-4/sampleMusicCatalog.csv, and we can use it to add documents to our musicCatalgoue example.
The following is an example of indexing data using the curl command:
curl 'http://localhost:8983/solr/musicCatalog/update' --data-binary @sampleMusicCatalog.csv -H 'Content-type:application/csv'
In the preceding command, we're telling CSVUpdateHandler to use the first line of the CSV as the header row, which will contain the field name. If the CSV does not have a header row, we can use the header=false parameter, which will tell UpdateHandler that there is no header row present. We ...
Read now
Unlock full access