{"id":772,"date":"2013-02-04T01:40:08","date_gmt":"2013-02-04T01:40:08","guid":{"rendered":"http:\/\/garysieling.com\/blog\/?p=772"},"modified":"2013-02-04T01:40:08","modified_gmt":"2013-02-04T01:40:08","slug":"solr-csv-dataimporthandler-sample","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/solr-csv-dataimporthandler-sample\/","title":{"rendered":"Solr CSV DataImportHandler sample"},"content":{"rendered":"<p>The following will import a two field CSV file into solr, assuming two columns, name and count. The name field is always quoted.<\/p>\n<p>&lt;dataConfig&gt;<br \/>\n&lt;dataSource name=&#8221;ds1&#8243; type=&#8221;FileDataSource&#8221; \/&gt;<br \/>\n&lt;document&gt;<br \/>\n&lt;entity name=&#8221;ngrams&#8221;<br \/>\nprocessor=&#8221;LineEntityProcessor&#8221;<br \/>\nurl=&#8221;E:\/Projects\/Data\/words-txt.csv&#8221;<br \/>\ndataSource=&#8221;ds1&#8243;<br \/>\ntransformer=&#8221;RegexTransformer&#8221;&gt;<br \/>\n&lt;field column=&#8221;rawLine&#8221;<br \/>\nregex=&#8221;^&amp;quot;(.*)&amp;quot;\\t(.*)$&#8221;<br \/>\ngroupNames=&#8221;name,count&#8221;<br \/>\n\/&gt;<br \/>\n&lt;\/entity&gt;<br \/>\n&lt;\/document&gt;<br \/>\n&lt;\/dataConfig&gt;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The following will import a two field CSV file into solr, assuming two columns, name and count. The name field is always quoted. &lt;dataConfig&gt; &lt;dataSource name=&#8221;ds1&#8243; type=&#8221;FileDataSource&#8221; \/&gt; &lt;document&gt; &lt;entity name=&#8221;ngrams&#8221; processor=&#8221;LineEntityProcessor&#8221; url=&#8221;E:\/Projects\/Data\/words-txt.csv&#8221; dataSource=&#8221;ds1&#8243; transformer=&#8221;RegexTransformer&#8221;&gt; &lt;field column=&#8221;rawLine&#8221; regex=&#8221;^&amp;quot;(.*)&amp;quot;\\t(.*)$&#8221; groupNames=&#8221;name,count&#8221; \/&gt; &lt;\/entity&gt; &lt;\/document&gt; &lt;\/dataConfig&gt;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4],"tags":[130,300,517],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/772"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=772"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/772\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=772"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=772"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=772"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}