Monday 15 June 2015

solr 4.3.1 indexing an xml file with DataImportHandler -


I'm running 7.1.1 on jboss 4.3.1. I'm trying to index a simple XML file

  & lt; Add & gt; & Lt; Doc & gt; & Lt; Field name = "fname" & gt; Test1 & lt; / Field & gt; & Lt; Field name = "number" & gt; 1 & lt; / Field & gt; & Lt; / Doc & gt; & Lt; / Add & gt;   

This file is test.xml and in C: \ solr-input \ test.xml

This is my data-config.mml < DataConfig>> pre & lt; & Lt; Data Source Type = "File Data Source" encoding = "UTF-8" /> & Lt; Document & gt; & Lt; Unit name = "page" processor = "XPathEntityProcessor" stream = "true" forEach = "/ doc" url = "C: \ solr-input \ test.xml" transformer = "reggae's transformer, dateformat transformer" & gt; & Lt; Field column = "name" xpath = "/ add / doc / field [@ name = 'fname']" index = "true" /> & Lt; Field column = "number" xpath = "/ add / doc / field [@ name = 'number']" indexed = "true" /> & lt; / Unit & gt; & Lt; / Documents & gt; & Lt; / DataConfig & gt;

that this folder is in the jboss / standalone / deployments / solr / collection1 / conf

folder and in the end, here is the code that I have added to solrconfig .xml

  & lt; RequestHandler name = "/ dataimport" class = "org.apache.solr.handler.dataimport.DataImportHandler" & gt; & Lt; Lst name = "defaults" & gt; & Lt; Str name = "config" & gt; Data-config.xml & lt; / Str & gt; & Lt; / Lst> & Lt; / RequestHandler & gt;   

Therefore, when I run the url

  & lt; Http: // localhost: 8080 / solr / dataimport? Command = full-import & gt;   

This tells me

   & Lt; Int name = "q time" & gt; 19 & lt; / Int> & Lt; / Lst> & Lt; Lst name = "initArgs" & gt; & Lt; Lst name = "defaults" & gt; & Lt; Str name = "config" & gt; Data-config.xml & lt; / Str & gt; & Lt; / Lst> & Lt; / Lst> & Lt; Str name = "command" & gt; Full-import & lt; / Str & gt; & Lt; Str name = "condition" & gt; Inactive & lt; / Str & gt; & Lt; Str name = "exclamation" /> & Lt; Lst name = "statusMessages" & gt; & Lt; Str name = "Total requests made for datasource" & gt; 0 & lt; / Str & gt; & Lt; Str name = "total line received" & gt; 0 & lt; / Str & gt; & Lt; Str name = "total document skipped" & gt; 0 & lt; / Str & gt; & Lt; Str name = "full dump started" & gt; 2013-06-21 12: 25: 03 & lt; / Str & gt; & Lt; Str name = "" & gt; Indexing complete is added / updated: 0 document deleted document & lt; / Str & gt; & Lt; Str name = "committed" & gt; 2013-06-21 12: 25: 04 & lt; / Str & gt; & Lt; Str name = "total document processed" & gt; 0 & lt; / Str & gt; & Lt; Str name = "took time" & gt; 0: 0: 0.148 & lt; / Str & gt; & Lt; / Lst> & Lt; Str name = "warning" & gt; This feedback format is experimental; it is likely to change in the future. / Str & gt; & Lt; / Reaction & gt;   

And if I

  & lt; Http: // localhost: 8080 / solr / collection1 / select? Q = test1 & amp; Wt = xml & amp; Indent = true>   

It does not show any results to me ...

What am I doing?

I had only one problem, the only thing that works for me was to add that line

  & lt; Lib dir = "../../../ dist /" regex = "solr-dataimporthandler -. * \ .jar" /> Solarconfig.xml in   

and put the XML file into folder / exampledocs. Now, it's working. I have tested your example and it's working fine. I hope it helps.

No comments:

Post a Comment