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 Leena Jawale <Le...@lntinfotech.com> on 2012/11/20 07:02:07 UTC
configuring solr xml as a datasource
Hi,
I am new to solr. I am trying to use solr xml data source for solr search engine.
I have created test.xml file as
-
<add>
<doc>
<field name="fname">leena1</field>
<field name="number">101</field>
</doc>
</add>
I have created data-config.xml file
<dataConfig>
<dataSource type="FileDataSource" encoding="UTF-8" />
<document>
<entity name="page"
processor="XPathEntityProcessor"
stream="true"
forEach="/rootelement"
url="C:\solr\conf\test.xml"
transformer="RegexTransformer,DateFormatTransformer">
<field column="name" xpath="/rootelement/name" />
<field column="number" xpath="/rootelement/number" />
</entity>
</document>
</dataConfig>
And added below code in solrconfig.xml :
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">C:\solr\conf\data-config.xml</str>
</lst>
</requestHandler>
But when I go to this link http://localhost:8080/solr/dataimport?command=full-import
Its showing Total Rows Fetched=0 , Total Documents Processed=0.
How can I solve this problem? Please provide me the solution.
Thanks & Regards,
Leena Jawale
Software Engineer Trainee
BFS BU
Phone No. - 9762658130
Email - leena.jawale@lntinfotech.com<ma...@lntinfotech.com>
________________________________
The contents of this e-mail and any attachment(s) may contain confidential or privileged information for the intended recipient(s). Unintended recipients are prohibited from taking action on the basis of information in this e-mail and using or disseminating the information, and must notify the sender and delete it from their system. L&T Infotech will not accept responsibility or liability for the accuracy or completeness of, or the presence of any virus or disabling code in this e-mail"
Re: configuring solr xml as a datasource
Posted by Lance Norskog <go...@gmail.com>.
You don't need the transformers.
I think the paths should be what is in the XML file.
forEach="/add"
And the paths need to use the syntax for name="fname" and name="number". I think this is it, but you should make sure.
xpath="/add/doc/field[@name='fname']"
xpath="/add/doc/field[@name='number']"
Look at the end of this section:
http://wiki.apache.org/solr/DataImportHandler#Configuration_in_data-config.xml-1
----- Original Message -----
| From: "Leena Jawale" <Le...@lntinfotech.com>
| To: solr-user@lucene.apache.org
| Sent: Monday, November 19, 2012 10:02:07 PM
| Subject: configuring solr xml as a datasource
|
| Hi,
|
| I am new to solr. I am trying to use solr xml data source for solr
| search engine.
| I have created test.xml file as
| -
| <add>
| <doc>
| <field name="fname">leena1</field>
| <field name="number">101</field>
| </doc>
| </add>
|
| I have created data-config.xml file
|
| <dataConfig>
| <dataSource type="FileDataSource" encoding="UTF-8" />
| <document>
| <entity name="page"
| processor="XPathEntityProcessor"
| stream="true"
| forEach="/rootelement"
| url="C:\solr\conf\test.xml"
| transformer="RegexTransformer,DateFormatTransformer">
| <field column="name" xpath="/rootelement/name" />
| <field column="number" xpath="/rootelement/number" />
|
| </entity>
| </document>
| </dataConfig>
|
| And added below code in solrconfig.xml :
| <requestHandler name="/dataimport"
| class="org.apache.solr.handler.dataimport.DataImportHandler">
| <lst name="defaults">
| <str name="config">C:\solr\conf\data-config.xml</str>
| </lst>
| </requestHandler>
|
| But when I go to this link
| http://localhost:8080/solr/dataimport?command=full-import
| Its showing Total Rows Fetched=0 , Total Documents Processed=0.
| How can I solve this problem? Please provide me the solution.
|
|
| Thanks & Regards,
| Leena Jawale
| Software Engineer Trainee
| BFS BU
| Phone No. - 9762658130
| Email -
| leena.jawale@lntinfotech.com<ma...@lntinfotech.com>
|
|
| ________________________________
| The contents of this e-mail and any attachment(s) may contain
| confidential or privileged information for the intended
| recipient(s). Unintended recipients are prohibited from taking
| action on the basis of information in this e-mail and using or
| disseminating the information, and must notify the sender and delete
| it from their system. L&T Infotech will not accept responsibility or
| liability for the accuracy or completeness of, or the presence of
| any virus or disabling code in this e-mail"
|