Over a million developers have joined DZone.

A Solr CSV DataImportHandler Sample

· Big Data Zone

Hortonworks DataFlow is an integrated platform that makes data ingestion fast, easy, and secure. Download the white paper now.  Brought to you in partnership with Hortonworks

The following will import a two field CSV file into solr, assuming two columns, name and count. The name field is always quoted.

<dataConfig>
<dataSource name=”ds1″ type=”FileDataSource” />
<document>
<entity name=”ngrams”
processor=”LineEntityProcessor”
url=”E:/Projects/Data/words-txt.csv”
dataSource=”ds1″
transformer=”RegexTransformer”>
<field column=”rawLine”
regex=”^"(.*)"\t(.*)$”
groupNames=”name,count”
/>
</entity>
</document>
</dataConfig>


Learn how you can modernize your data warehouse with Apache Hadoop. View an on-demand webinar now. Brought to you in partnership with Hortonworks.

Topics:

Published at DZone with permission of Gary Sieling, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}