I made it work with the simplest of xml-files with some inspiration from 
https://opensolr.com/blog/2011/09/how-to-import-data-from-xml-files-into-your-solr-collection
 .

Data-config is now:

<dataConfig>
  <dataSource name="myfilereader" type="FileDataSource" encoding="UTF-8"/>
    <document>
      <entity
        name="xml"
        pk="id"
        processor="XPathEntityProcessor"
        useSolrAddSchema="true"
        url="C:/Users/z6mhq/Desktop/data_import/nh_test.xml">
      </entity>
  </document>
</dataConfig>

And the document is simply:

<add>
   <doc>
        <field name="id"> 2165432</field>
        <field name="journalnummer"> 5</field>
   </doc>

   <doc>
        <field name="id"> 28548113</field>
        <field name="journalnummer"> 89</field>
   </doc>
</add>

Now I guess I just have to add to this solution.

Thanks for your help Alex, and also thanks to Jan answering the first mail.

Best regards
Martin Frank Hansen

-----Oprindelig meddelelse-----
Fra: Alexandre Rafalovitch <arafa...@gmail.com>
Sendt: 2. oktober 2018 19:52
Til: solr-user <solr-user@lucene.apache.org>
Emne: Re: data-import-handler for solr-7.5.0

Ok, so then you can switch to debug mode and keep trying to figure it out. Also 
try BinFileDataSource or URLDataSource, maybe it will have an easier way.

Or using relative path (example:
https://github.com/arafalov/solr-apachecon2018-presentation/blob/master/configsets/pets-final/pets-data-config.xml).

Regards,
   Alex.
On Tue, 2 Oct 2018 at 12:46, Martin Frank Hansen (MHQ) <m...@kmd.dk> wrote:
>
> Thanks for the info, the UI looks interesting... It does read the data-config 
> correctly, so the problem is probably in this file.
>
> Martin Frank Hansen, Senior Data Analytiker
>
> Data, IM & Analytics
>
>
>
> Lautrupparken 40-42, DK-2750 Ballerup
> E-mail m...@kmd.dk  Web www.kmd.dk
> Mobil +4525571418
>
> -----Oprindelig meddelelse-----
> Fra: Alexandre Rafalovitch <arafa...@gmail.com>
> Sendt: 2. oktober 2018 18:18
> Til: solr-user <solr-user@lucene.apache.org>
> Emne: Re: data-import-handler for solr-7.5.0
>
> Admin UI for DIH will show you the config file read. So, if nothing is
> there, the path is most likely the issue
>
> You can also provide or update the configuration right in UI if you enable 
> debug.
>
> Finally, the config file is reread on every invocation, so you don't need to 
> restart the core after changing it.
>
> Hope this helps,
>    Alex.
> On Tue, 2 Oct 2018 at 11:45, Jan Høydahl <jan....@cominvent.com> wrote:
> >
> > > url="C:/Users/z6mhq/Desktop/data_import/nh_test.xml"
> >
> > Have you tried url="C:\\Users\\z6mhq/Desktop\\data_import\\nh_test.xml" ?
> >
> > --
> > Jan Høydahl, search solution architect Cominvent AS -
> > www.cominvent.com
> >
> > > 2. okt. 2018 kl. 17:15 skrev Martin Frank Hansen (MHQ) <m...@kmd.dk>:
> > >
> > > Hi,
> > >
> > > I am having some problems getting the data-import-handler in Solr to 
> > > work. I have tried a lot of things but I simply get no response from 
> > > Solr, not even an error.
> > >
> > > When calling the API:
> > > http://localhost:8983/solr/nh/dataimport?command=full-import
> > > {
> > >  "responseHeader":{
> > >    "status":0,
> > >    "QTime":38},
> > >  "initArgs":[
> > >    "defaults",[
> > >
> > > "config","C:/Users/z6mhq/Desktop/nh/nh/conf/data-config.xml"]],
> > >  "command":"full-import",
> > >  "status":"idle",
> > >  "importResponse":"",
> > >  "statusMessages":{}}
> > >
> > > The data looks like this:
> > >
> > > <journal>
> > >  <doc>
> > >        <field name="id"> 2165432</field>
> > >        <field name="journalnummer"> 5</field>  </doc>
> > >
> > >  <doc>
> > >        <field name="id"> 28548113</field>
> > >        <field name="journalnummer"> 89</field>  </doc> </journal>
> > >
> > >
> > > The data-config file looks like this:
> > >
> > > <dataConfig>
> > >  <dataSource name="myfilereader" type="FileDataSource" encoding="UTF-8"/>
> > >    <document>
> > >      <entity
> > >        name="xml"
> > >        pk="id"
> > >        processor="XPathEntityProcessor"
> > >        stream="true"
> > >        forEach="/journal/doc"
> > >        url="C:/Users/z6mhq/Desktop/data_import/nh_test.xml"
> > >        transformer="RegexTransformer,TemplateTransformer"
> > >>
> > >        <field column="id" xpath="/journal/doc" />
> > >        <field column="journalnummer" xpath="/journal/doc"/>
> > >
> > >      </entity>
> > >  </document>
> > > </dataConfig>
> > >
> > > And I referenced the jar files in the solr-config.xml as well as adding 
> > > the request-handler by adding the following lines:
> > >
> > > <lib dir="${solr.install.dir:../../../..}/dist/"
> > > regex="solr-dataimporthandler-\d.*\.jar" /> <lib
> > > dir="${solr.install.dir:../../../..}/dist/"
> > > regex="solr-dataimporthandler-extras-\d.*\.jar" />
> > >
> > >
> > > <requestHandler name="/dataimport" 
> > > class="org.apache.solr.handler.dataimport.DataImportHandler">
> > >    <lst name="defaults">
> > >      <str 
> > > name="config">C:/Users/z6mhq/Desktop/nh/nh/conf/data-config.xml</str>
> > >    </lst>
> > >  </requestHandler>
> > >
> > > I am running a core residing in the folder 
> > > “C:/Users/z6mhq/Desktop/nh/nh/conf” while the Solr installation is in 
> > > “C:/Users/z6mhq/Documents/solr-7.5.0”.
> > >
> > > I really hope that someone can spot my mistake…
> > >
> > > Thanks in advance.
> > >
> > > Martin Frank Hansen
> > >
> > >
> > > Beskyttelse af dine personlige oplysninger er vigtig for os. Her finder 
> > > du KMD’s Privatlivspolitik<http://www.kmd.dk/Privatlivspolitik>, der 
> > > fortæller, hvordan vi behandler oplysninger om dig.
> > >
> > > Protection of your personal data is important to us. Here you can read 
> > > KMD’s Privacy Policy<http://www.kmd.net/Privacy-Policy> outlining how we 
> > > process your personal data.
> > >
> > > Vi gør opmærksom på, at denne e-mail kan indeholde fortrolig information. 
> > > Hvis du ved en fejltagelse modtager e-mailen, beder vi dig venligst 
> > > informere afsender om fejlen ved at bruge svarfunktionen. Samtidig beder 
> > > vi dig slette e-mailen i dit system uden at videresende eller kopiere 
> > > den. Selvom e-mailen og ethvert vedhæftet bilag efter vores overbevisning 
> > > er fri for virus og andre fejl, som kan påvirke computeren eller 
> > > it-systemet, hvori den modtages og læses, åbnes den på modtagerens eget 
> > > ansvar. Vi påtager os ikke noget ansvar for tab og skade, som er opstået 
> > > i forbindelse med at modtage og bruge e-mailen.
> > >
> > > Please note that this message may contain confidential information. If 
> > > you have received this message by mistake, please inform the sender of 
> > > the mistake by sending a reply, then delete the message from your system 
> > > without making, distributing or retaining any copies of it. Although we 
> > > believe that the message and any attachments are free from viruses and 
> > > other errors that might affect the computer or it-system where it is 
> > > received and read, the recipient opens the message at his or her own 
> > > risk. We assume no responsibility for any loss or damage arising from the 
> > > receipt or use of this message.
> >

Reply via email to