Big Data/Analytics Zone is brought to you in partnership with:

Gary Sieling is a software developer interested in dev-ops, database technologies, and machine learning. He has a computer science degree from the Rochester Institute of Technology. He has worked on many products in the legal and regulatory industries, having worked on and supported several data warehousing applications. Gary is a DZone MVB and is not an employee of DZone and has posted 62 posts at DZone. You can read more from them at their website. View Full User Profile

A Solr CSV DataImportHandler Sample

02.05.2013
| 3867 views |
  • submit to reddit

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>


Published at DZone with permission of Gary Sieling, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)