1

I'm trying to only import certain columns of a CSV file into Solr, but I'm not sure how to do this or if this is even possible with Solr. Currently, I'm using one of the books.csv examples that came with the Solr installation (can be found in C:\solr-5.2.1\example\exampledocs).

The below xml that I put in the schema.xml file works if all fields are included, but if I comment some fields out, Solr complains about unknown fields that are the ones commented out.

<uniqueKey>id</uniqueKey>

<!-- Fields added for books.csv load-->
<field name="cat" type="text_general" indexed="true" stored="true"/>
<field name="name" type="text_general" indexed="true" stored="true"/>
<field name="price" type="tdouble" indexed="true" stored="true"/>

<!-- these columns commented out
<field name="inStock" type="boolean" indexed="true" stored="true"/>
<field name="author" type="text_general" indexed="true" stored="true"/>
-->

Because the post script in C:\solr-5.2.1\bin is a shell script and wont run in Windows, which I am using, I need to use the post.jar file located in the same place as the books.csv file.

java -Dtype=text/csv -Durl=http://localhost:8983/solr/jcg/update -jar post.jar books.csv
darthsidious
  • 2,851
  • 3
  • 19
  • 30
Mushu909
  • 1,194
  • 2
  • 11
  • 16

1 Answers1

0

CSV Update Handler has a large number of parameters to control CSV import process. skip seems the most relevant to your specific problem.

Alexandre Rafalovitch
  • 9,709
  • 1
  • 24
  • 27