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 Jianbin Dai <dj...@yahoo.com> on 2009/05/20 08:05:50 UTC

Help needed on DataImportHandler to index xml files

Hi All,
I am new here. Thanks for reading my question.
I want to use DataImportHandler to index my tons of xml files (7GB total) stored in my local disk. My data-config.xml is attached below. It works fine with one file (abc.xml), but how can I index all xml files at one time? Thanks!


<dataConfig>
        <dataSource type="FileDataSource" />
        <document>
                <entity name="example"
                        url="/root/abc.xml"
                        processor="XPathEntityProcessor"
                        forEach="/ShopzillaQueryResponse/product"
                        transformer="DateFormatTransformer">

                        <field column="id"  xpath="/ShopzillaQueryResponse/product/id" />
                        <field column="name"        xpath="/ShopzillaQueryResponse/product/name" />
                        <field column="sku"         xpath="/ShopzillaQueryResponse/product/sku" />
                        <field column="mydescription"  xpath="/ShopzillaQueryResponse/product/desc_short" />
                        <field column="price"      xpath="/ShopzillaQueryResponse/product/merchantListing/merchantProduct/price" />

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



      

Re: Help needed on DataImportHandler to index xml files

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@corp.aol.com>.
there is an example given for the same

http://wiki.apache.org/solr/DataImportHandler#head-8edbc7e588d97068aa0a61ed2e3e8e61b43debce



On Wed, May 20, 2009 at 11:35 AM, Jianbin Dai <dj...@yahoo.com> wrote:
>
> Hi All,
> I am new here. Thanks for reading my question.
> I want to use DataImportHandler to index my tons of xml files (7GB total) stored in my local disk. My data-config.xml is attached below. It works fine with one file (abc.xml), but how can I index all xml files at one time? Thanks!
>
>
> <dataConfig>
>        <dataSource type="FileDataSource" />
>        <document>
>                <entity name="example"
>                        url="/root/abc.xml"
>                        processor="XPathEntityProcessor"
>                        forEach="/ShopzillaQueryResponse/product"
>                        transformer="DateFormatTransformer">
>
>                        <field column="id"  xpath="/ShopzillaQueryResponse/product/id" />
>                        <field column="name"        xpath="/ShopzillaQueryResponse/product/name" />
>                        <field column="sku"         xpath="/ShopzillaQueryResponse/product/sku" />
>                        <field column="mydescription"  xpath="/ShopzillaQueryResponse/product/desc_short" />
>                        <field column="price"      xpath="/ShopzillaQueryResponse/product/merchantListing/merchantProduct/price" />
>
>                </entity>
>        </document>
> </dataConfig>
>
>
>
>
>



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