You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by jayakeerthi s <ma...@gmail.com> on 2009/05/15 21:53:28 UTC

query regarding Indexing xml files -db-data-config.xml

Hi All,

I am trying to index the fileds from the xml files, here is the
configuration that I am using.


db-data-config.xml

<dataConfig>
    <dataSource type="FileDataSource" name ="xmlindex"/>
    <document name="products">
     <entity name="xmlfile" processor="FileListEntityProcessor"
fileName="c:\test\ipod_other.xml"  recursive="true" rootEntity="false"
dataSource="null" baseDir="${dataimporter.request.xmlDataDir}">
     <entity name="data" processor="XPathEntityProcessor" forEach="/record |
/the/record/xpath"  url="${xmlfile.fileAbsolutePath}">
            <field column="manu"
name="manu"/>

     </entity>
        </entity>
       </document>
</dataConfig>

Schema.xml has the field "manu"

The input xml file used to import the field is

<doc>
  <field name="id">F8V7067-APL-KIT</field>
  <field name="name">Belkin Mobile Power Cord for iPod w/ Dock</field>
  <field name="manu">Belkin</field>
  <field name="cat">electronics</field>
  <field name="cat">connector</field>
  <field name="features">car power adapter, white</field>
  <field name="weight">4</field>
  <field name="price">19.95</field>
  <field name="popularity">1</field>
  <field name="inStock">false</field>
</doc>


doing the full-import this is the response I am getting

- <lst name="statusMessages">
  <str name="Total Requests made to DataSource">0</str>
  <str name="Total Rows Fetched">0</str>
  <str name="Total Documents Skipped">0</str>
  <str name="Full Dump Started">2009-05-15 11:58:00</str>
  <str name="">Indexing completed. Added/Updated: 0 documents. Deleted 0
documents.</str>
  <str name="Committed">2009-05-15 11:58:00</str>
  <str name="Optimized">2009-05-15 11:58:00</str>
  <str name="Time taken">0:0:0.172</str>
  </lst>
  <str name="WARNING">This response format is experimental. It is likely to
change in the future.</str>
  </response>


Do I missing anything here or is there any format on the input xml,?? please
help resolving this.

Thanks and regards,
Jay

Re: query regarding Indexing xml files -db-data-config.xml

Posted by jayakeerthi s <ma...@gmail.com>.
Hi  Noble,

Thanks for the reply,

As advised I have changed the db-data-config.xml as below. But still the
<str name="">Indexing completed. Added/Updated: 0 documents. Deleted 0
documents.</str>

<dataConfig>
    <dataSource type="FileDataSource" name ="xmlindex"/>
    <document name="products">
     <entity name="xmlfile" processor="FileListEntityProcessor"
fileName="c:\\test\\ipod_other.xml"  recursive="true" rootEntity="false"
dataSource="null" baseDir="${dataimporter.request.xmlDataDir}"
useSolrAddSchema="true">
        <entity name="data" processor="XPathEntityProcessor"
url="${xmlfile.fileAbsolutePath}">
          <field column="manu" name="manu"/>
          </entity>
           </entity>
       </document>
</dataConfig>


Got error as below when baseDir is removed

INFO: last commit = 1242683454570
May 18, 2009 2:55:15 PM org.apache.solr.handler.dataimport.DataImporter
doFullImport
SEVERE: Full Import failed
org.apache.solr.handler.dataimport.DataImportHandlerException: 'baseDir' is
a required attribute Pro
cessing Document # 1
        at
org.apache.solr.handler.dataimport.FileListEntityProcessor.init(FileListEntityProcessor.j
ava:76)
        at
org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:299)
        at
org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:225)
        at
org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:167)
        at
org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:324)
        at
org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:382)
        at
org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:363)
May 18, 2009 2:55:15 PM org.apache.solr.update.DirectUpdateHandler2 rollback
INFO: start rollback

Please advise.

Thanks and regards,
Jay

2009/5/17 Noble Paul നോബിള്‍ नोब्ळ् <no...@corp.aol.com>

> hi ,
> u may not need that enclosing entity , if you only wish to index one file.
>
> baseDir is not required if you give absolute path in the fileName.
>
> no need to mention forEach or fields if you set useSolrAddSchema="true"
>
> On Sat, May 16, 2009 at 1:23 AM, jayakeerthi s <ma...@gmail.com>
> wrote:
> > Hi All,
> >
> > I am trying to index the fileds from the xml files, here is the
> > configuration that I am using.
> >
> >
> > db-data-config.xml
> >
> > <dataConfig>
> >    <dataSource type="FileDataSource" name ="xmlindex"/>
> >    <document name="products">
> >     <entity name="xmlfile" processor="FileListEntityProcessor"
> > fileName="c:\test\ipod_other.xml"  recursive="true" rootEntity="false"
> > dataSource="null" baseDir="${dataimporter.request.xmlDataDir}">
> >     <entity name="data" processor="XPathEntityProcessor" forEach="/record
> |
> > /the/record/xpath"  url="${xmlfile.fileAbsolutePath}">
> >            <field column="manu"
> > name="manu"/>
> >
> >     </entity>
> >        </entity>
> >       </document>
> > </dataConfig>
> >
> > Schema.xml has the field "manu"
> >
> > The input xml file used to import the field is
> >
> > <doc>
> >  <field name="id">F8V7067-APL-KIT</field>
> >  <field name="name">Belkin Mobile Power Cord for iPod w/ Dock</field>
> >  <field name="manu">Belkin</field>
> >  <field name="cat">electronics</field>
> >  <field name="cat">connector</field>
> >  <field name="features">car power adapter, white</field>
> >  <field name="weight">4</field>
> >  <field name="price">19.95</field>
> >  <field name="popularity">1</field>
> >  <field name="inStock">false</field>
> > </doc>
> >
> >
> > doing the full-import this is the response I am getting
> >
> > - <lst name="statusMessages">
> >  <str name="Total Requests made to DataSource">0</str>
> >  <str name="Total Rows Fetched">0</str>
> >  <str name="Total Documents Skipped">0</str>
> >  <str name="Full Dump Started">2009-05-15 11:58:00</str>
> >  <str name="">Indexing completed. Added/Updated: 0 documents. Deleted 0
> > documents.</str>
> >  <str name="Committed">2009-05-15 11:58:00</str>
> >  <str name="Optimized">2009-05-15 11:58:00</str>
> >  <str name="Time taken">0:0:0.172</str>
> >  </lst>
> >  <str name="WARNING">This response format is experimental. It is likely
> to
> > change in the future.</str>
> >  </response>
> >
> >
> > Do I missing anything here or is there any format on the input xml,??
> please
> > help resolving this.
> >
> > Thanks and regards,
> > Jay
> >
>
>
>
> --
> -----------------------------------------------------
> Noble Paul | Principal Engineer| AOL | http://aol.com
>

Re: query regarding Indexing xml files -db-data-config.xml

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@corp.aol.com>.
hi ,
u may not need that enclosing entity , if you only wish to index one file.

baseDir is not required if you give absolute path in the fileName.

no need to mention forEach or fields if you set useSolrAddSchema="true"

On Sat, May 16, 2009 at 1:23 AM, jayakeerthi s <ma...@gmail.com> wrote:
> Hi All,
>
> I am trying to index the fileds from the xml files, here is the
> configuration that I am using.
>
>
> db-data-config.xml
>
> <dataConfig>
>    <dataSource type="FileDataSource" name ="xmlindex"/>
>    <document name="products">
>     <entity name="xmlfile" processor="FileListEntityProcessor"
> fileName="c:\test\ipod_other.xml"  recursive="true" rootEntity="false"
> dataSource="null" baseDir="${dataimporter.request.xmlDataDir}">
>     <entity name="data" processor="XPathEntityProcessor" forEach="/record |
> /the/record/xpath"  url="${xmlfile.fileAbsolutePath}">
>            <field column="manu"
> name="manu"/>
>
>     </entity>
>        </entity>
>       </document>
> </dataConfig>
>
> Schema.xml has the field "manu"
>
> The input xml file used to import the field is
>
> <doc>
>  <field name="id">F8V7067-APL-KIT</field>
>  <field name="name">Belkin Mobile Power Cord for iPod w/ Dock</field>
>  <field name="manu">Belkin</field>
>  <field name="cat">electronics</field>
>  <field name="cat">connector</field>
>  <field name="features">car power adapter, white</field>
>  <field name="weight">4</field>
>  <field name="price">19.95</field>
>  <field name="popularity">1</field>
>  <field name="inStock">false</field>
> </doc>
>
>
> doing the full-import this is the response I am getting
>
> - <lst name="statusMessages">
>  <str name="Total Requests made to DataSource">0</str>
>  <str name="Total Rows Fetched">0</str>
>  <str name="Total Documents Skipped">0</str>
>  <str name="Full Dump Started">2009-05-15 11:58:00</str>
>  <str name="">Indexing completed. Added/Updated: 0 documents. Deleted 0
> documents.</str>
>  <str name="Committed">2009-05-15 11:58:00</str>
>  <str name="Optimized">2009-05-15 11:58:00</str>
>  <str name="Time taken">0:0:0.172</str>
>  </lst>
>  <str name="WARNING">This response format is experimental. It is likely to
> change in the future.</str>
>  </response>
>
>
> Do I missing anything here or is there any format on the input xml,?? please
> help resolving this.
>
> Thanks and regards,
> Jay
>



-- 
-----------------------------------------------------
Noble Paul | Principal Engineer| AOL | http://aol.com

Re: query regarding Indexing xml files -db-data-config.xml

Posted by Fergus McMenemie <fe...@twig.me.uk>.
Hmmm, 

I thought that if you were using the XPathEntityProcessor that 
you have to specify an xpath for each of the fields you want
to populate. Unless you are using XPathEntityProcessor's use
useSolrAddSchema mode?

Fergus.

>If that is your complete input file then it looks like you are missing the
>wrapping <add></add> element:
>
><add>
><doc>
> <field name="id">F8V7067-APL-KIT</
>>
>> field>
>>  <field name="name">Belkin Mobile Power Cord for iPod w/ Dock</field>
>>  <field name="manu">Belkin</field>
>>  <field name="cat">electronics</field>
>>  <field name="cat">connector</field>
>>  <field name="features">car power adapter, white</field>
>>  <field name="weight">4</field>
>>  <field name="price">19.95</field>
>>  <field name="popularity">1</field>
>>  <field name="inStock">false</field>
>> </doc>
>
></add>
>
>Is it possible you just forgot to include the <add>?
>
>-Jay
>
>
>On Fri, May 15, 2009 at 12:53 PM, jayakeerthi s <ma...@gmail.com>wrote:
>
>> Hi All,
>>
>> I am trying to index the fileds from the xml files, here is the
>> configuration that I am using.
>>
>>
>> db-data-config.xml
>>
>> <dataConfig>
>>    <dataSource type="FileDataSource" name ="xmlindex"/>
>>    <document name="products">
>>     <entity name="xmlfile" processor="FileListEntityProcessor"
>> fileName="c:\test\ipod_other.xml"  recursive="true" rootEntity="false"
>> dataSource="null" baseDir="${dataimporter.request.xmlDataDir}">
>>     <entity name="data" processor="XPathEntityProcessor" forEach="/record |
>> /the/record/xpath"  url="${xmlfile.fileAbsolutePath}">
>>            <field column="manu"
>> name="manu"/>
>>
>>     </entity>
>>        </entity>
>>       </document>
>> </dataConfig>
>>
>> Schema.xml has the field "manu"
>>
>> The input xml file used to import the field is
>>
>> <doc>
>>  <field name="id">F8V7067-APL-KIT</field>
>>  <field name="name">Belkin Mobile Power Cord for iPod w/ Dock</field>
>>  <field name="manu">Belkin</field>
>>  <field name="cat">electronics</field>
>>  <field name="cat">connector</field>
>>  <field name="features">car power adapter, white</field>
>>  <field name="weight">4</field>
>>  <field name="price">19.95</field>
>>  <field name="popularity">1</field>
>>  <field name="inStock">false</field>
>> </doc>
>>
>>
>> doing the full-import this is the response I am getting
>>
>> - <lst name="statusMessages">
>>  <str name="Total Requests made to DataSource">0</str>
>>  <str name="Total Rows Fetched">0</str>
>>  <str name="Total Documents Skipped">0</str>
>>  <str name="Full Dump Started">2009-05-15 11:58:00</str>
>>  <str name="">Indexing completed. Added/Updated: 0 documents. Deleted 0
>> documents.</str>
>>  <str name="Committed">2009-05-15 11:58:00</str>
>>  <str name="Optimized">2009-05-15 11:58:00</str>
>>  <str name="Time taken">0:0:0.172</str>
>>  </lst>
>>  <str name="WARNING">This response format is experimental. It is likely to
>> change in the future.</str>
>>  </response>
>>
>>
>> Do I missing anything here or is there any format on the input xml,??
>> please
>> help resolving this.
>>
>> Thanks and regards,
>> Jay
>>

-- 

===============================================================
Fergus McMenemie               Email:fergus@twig.me.uk
Techmore Ltd                   Phone:(UK) 07721 376021

Unix/Mac/Intranets             Analyst Programmer
===============================================================

Re: query regarding Indexing xml files -db-data-config.xml

Posted by jayakeerthi s <ma...@gmail.com>.
Many thanks for the reply

The complete input xml file is below I missed to include this earlier.


<add>
<doc>
  <field name="id">F8V7067-APL-KIT</field>
  <field name="name">Belkin Mobile Power Cord for iPod w/ Dock</field>
  <field name="manu">Belkin</field>
  <field name="cat">electronics</field>
  <field name="cat">connector</field>
  <field name="features">car power adapter, white</field>
  <field name="weight">4</field>
  <field name="price">19.95</field>
  <field name="popularity">1</field>
  <field name="inStock">false</field>
</doc>
<doc>
  <field name="id">IW-02</field>
  <field name="name">iPod &amp; iPod Mini USB 2.0 Cable</field>
  <field name="manu">Belkin</field>
  <field name="cat">electronics</field>
  <field name="cat">connector</field>
  <field name="features">car power adapter for iPod, white</field>
  <field name="weight">2</field>
  <field name="price">11.50</field>
  <field name="popularity">1</field>
  <field name="inStock">false</field>
</doc>

</add>

regards,
Jay
On Fri, May 15, 2009 at 1:14 PM, Jay Hill <ja...@gmail.com> wrote:

> If that is your complete input file then it looks like you are missing the
> wrapping <add></add> element:
>
> <add>
> <doc>
>  <field name="id">F8V7067-APL-KIT</
> >
> > field>
> >  <field name="name">Belkin Mobile Power Cord for iPod w/ Dock</field>
> >  <field name="manu">Belkin</field>
> >  <field name="cat">electronics</field>
> >  <field name="cat">connector</field>
> >  <field name="features">car power adapter, white</field>
> >  <field name="weight">4</field>
> >  <field name="price">19.95</field>
> >  <field name="popularity">1</field>
> >  <field name="inStock">false</field>
> > </doc>
>
> </add>
>
> Is it possible you just forgot to include the <add>?
>
> -Jay
>
>
> On Fri, May 15, 2009 at 12:53 PM, jayakeerthi s <mail2keerthi@gmail.com
> >wrote:
>
> > Hi All,
> >
> > I am trying to index the fileds from the xml files, here is the
> > configuration that I am using.
> >
> >
> > db-data-config.xml
> >
> > <dataConfig>
> >    <dataSource type="FileDataSource" name ="xmlindex"/>
> >    <document name="products">
> >     <entity name="xmlfile" processor="FileListEntityProcessor"
> > fileName="c:\test\ipod_other.xml"  recursive="true" rootEntity="false"
> > dataSource="null" baseDir="${dataimporter.request.xmlDataDir}">
> >     <entity name="data" processor="XPathEntityProcessor" forEach="/record
> |
> > /the/record/xpath"  url="${xmlfile.fileAbsolutePath}">
> >            <field column="manu"
> > name="manu"/>
> >
> >     </entity>
> >        </entity>
> >       </document>
> > </dataConfig>
> >
> > Schema.xml has the field "manu"
> >
> > The input xml file used to import the field is
> >
> > <doc>
> >  <field name="id">F8V7067-APL-KIT</field>
> >  <field name="name">Belkin Mobile Power Cord for iPod w/ Dock</field>
> >  <field name="manu">Belkin</field>
> >  <field name="cat">electronics</field>
> >  <field name="cat">connector</field>
> >  <field name="features">car power adapter, white</field>
> >  <field name="weight">4</field>
> >  <field name="price">19.95</field>
> >  <field name="popularity">1</field>
> >  <field name="inStock">false</field>
> > </doc>
> >
> >
> > doing the full-import this is the response I am getting
> >
> > - <lst name="statusMessages">
> >  <str name="Total Requests made to DataSource">0</str>
> >  <str name="Total Rows Fetched">0</str>
> >  <str name="Total Documents Skipped">0</str>
> >  <str name="Full Dump Started">2009-05-15 11:58:00</str>
> >  <str name="">Indexing completed. Added/Updated: 0 documents. Deleted 0
> > documents.</str>
> >  <str name="Committed">2009-05-15 11:58:00</str>
> >  <str name="Optimized">2009-05-15 11:58:00</str>
> >  <str name="Time taken">0:0:0.172</str>
> >  </lst>
> >  <str name="WARNING">This response format is experimental. It is likely
> to
> > change in the future.</str>
> >  </response>
> >
> >
> > Do I missing anything here or is there any format on the input xml,??
> > please
> > help resolving this.
> >
> > Thanks and regards,
> > Jay
> >
>

Re: query regarding Indexing xml files -db-data-config.xml

Posted by Jay Hill <ja...@gmail.com>.
If that is your complete input file then it looks like you are missing the
wrapping <add></add> element:

<add>
<doc>
 <field name="id">F8V7067-APL-KIT</
>
> field>
>  <field name="name">Belkin Mobile Power Cord for iPod w/ Dock</field>
>  <field name="manu">Belkin</field>
>  <field name="cat">electronics</field>
>  <field name="cat">connector</field>
>  <field name="features">car power adapter, white</field>
>  <field name="weight">4</field>
>  <field name="price">19.95</field>
>  <field name="popularity">1</field>
>  <field name="inStock">false</field>
> </doc>

</add>

Is it possible you just forgot to include the <add>?

-Jay


On Fri, May 15, 2009 at 12:53 PM, jayakeerthi s <ma...@gmail.com>wrote:

> Hi All,
>
> I am trying to index the fileds from the xml files, here is the
> configuration that I am using.
>
>
> db-data-config.xml
>
> <dataConfig>
>    <dataSource type="FileDataSource" name ="xmlindex"/>
>    <document name="products">
>     <entity name="xmlfile" processor="FileListEntityProcessor"
> fileName="c:\test\ipod_other.xml"  recursive="true" rootEntity="false"
> dataSource="null" baseDir="${dataimporter.request.xmlDataDir}">
>     <entity name="data" processor="XPathEntityProcessor" forEach="/record |
> /the/record/xpath"  url="${xmlfile.fileAbsolutePath}">
>            <field column="manu"
> name="manu"/>
>
>     </entity>
>        </entity>
>       </document>
> </dataConfig>
>
> Schema.xml has the field "manu"
>
> The input xml file used to import the field is
>
> <doc>
>  <field name="id">F8V7067-APL-KIT</field>
>  <field name="name">Belkin Mobile Power Cord for iPod w/ Dock</field>
>  <field name="manu">Belkin</field>
>  <field name="cat">electronics</field>
>  <field name="cat">connector</field>
>  <field name="features">car power adapter, white</field>
>  <field name="weight">4</field>
>  <field name="price">19.95</field>
>  <field name="popularity">1</field>
>  <field name="inStock">false</field>
> </doc>
>
>
> doing the full-import this is the response I am getting
>
> - <lst name="statusMessages">
>  <str name="Total Requests made to DataSource">0</str>
>  <str name="Total Rows Fetched">0</str>
>  <str name="Total Documents Skipped">0</str>
>  <str name="Full Dump Started">2009-05-15 11:58:00</str>
>  <str name="">Indexing completed. Added/Updated: 0 documents. Deleted 0
> documents.</str>
>  <str name="Committed">2009-05-15 11:58:00</str>
>  <str name="Optimized">2009-05-15 11:58:00</str>
>  <str name="Time taken">0:0:0.172</str>
>  </lst>
>  <str name="WARNING">This response format is experimental. It is likely to
> change in the future.</str>
>  </response>
>
>
> Do I missing anything here or is there any format on the input xml,??
> please
> help resolving this.
>
> Thanks and regards,
> Jay
>