Over a million developers have joined DZone.
Platinum Partner

A Solr CSV DataImportHandler Sample

· Big Data Zone

The Big Data Zone is presented by Exaptive.  Learn about how to rapidly iterate data applications, while reusing existing code and leveraging open source technologies.

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>


The Big Data Zone is brought to you in partnership with Exaptive.  Learn how Rapid Application Development powers business. 

Topics:

Published at DZone with permission of Gary Sieling , DZone MVB .

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}