Discussion:
problem with DIH and MySQL
Nick Friedrich
2009-01-20 15:37:42 UTC
Permalink
Hi,

I'm new to Solr and I have a problem.
I want to use DIH to index data stored in a MySQL database.

I added to solrconfig.xml

<requestHandler name="/dataimport"
class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">data-config.xml</str>
</lst>
</requestHandler>

The schema.xml is modified. Now there are just two fields

<field name="paper_ID_pk" type="string" indexed="true" stored="true"
required="true" />
<field name="title" type="text" indexed="true" stored="true"
required="false"/>

"paper_ID_pk" is set to be the uniqueKey.


The data-config.xml:

<dataConfig>
<dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/db_name" user="user" password="pw" />
<document name="documents">
<entity name="documents" query="select * from documents">
<field column="paper_ID_pk" name="paper_ID_pk" />
<field column="title" name="title" />

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


When I try to make a full import via http nothing is indexed.
A look at the status returns always this

<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">0</int>
</lst>
<lst name="initArgs">
<lst name="defaults">
<str name="config">data-config.xml</str>
</lst>
</lst>
<str name="command">status</str>
<str name="status">idle</str>
<str name="importResponse"/>
<lst name="statusMessages">
<str name="Time Elapsed">0:0:5.766</str>
<str name="Total Requests made to DataSource">0</str>
<str name="Total Rows Fetched">0</str>
<str name="Total Documents Processed">0</str>
<str name="Total Documents Skipped">0</str>
<str name="Full Dump Started">2009-01-20 14:21:36</str>
<str name="">Indexing failed. Rolled back all changes.</str>
<str name="Rolledback">2009-01-20 14:21:36</str>
</lst>
<str name="WARNING">This response format is experimental. It is
likely to change in the future.</str>
</response>

Adding some data e.g. via curl works fine. So, I think the schema.xml
is correct.

I hope somebody can help.

Thanks,
Nick
Noble Paul നോബിള്‍ नोब्ळ्
2009-01-20 15:44:19 UTC
Permalink
it got rolled back
any exceptions on solr console?

On Tue, Jan 20, 2009 at 9:07 PM, Nick Friedrich
Post by Nick Friedrich
Hi,
I'm new to Solr and I have a problem.
I want to use DIH to index data stored in a MySQL database.
I added to solrconfig.xml
<requestHandler name="/dataimport"
class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">data-config.xml</str>
</lst>
</requestHandler>
The schema.xml is modified. Now there are just two fields
<field name="paper_ID_pk" type="string" indexed="true" stored="true"
required="true" />
<field name="title" type="text" indexed="true" stored="true"
required="false"/>
"paper_ID_pk" is set to be the uniqueKey.
<dataConfig>
<dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/db_name" user="user" password="pw" />
<document name="documents">
<entity name="documents" query="select * from documents">
<field column="paper_ID_pk" name="paper_ID_pk" />
<field column="title" name="title" />
</entity>
</document>
</dataConfig>
When I try to make a full import via http nothing is indexed.
A look at the status returns always this
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">0</int>
</lst>
<lst name="initArgs">
<lst name="defaults">
<str name="config">data-config.xml</str>
</lst>
</lst>
<str name="command">status</str>
<str name="status">idle</str>
<str name="importResponse"/>
<lst name="statusMessages">
<str name="Time Elapsed">0:0:5.766</str>
<str name="Total Requests made to DataSource">0</str>
<str name="Total Rows Fetched">0</str>
<str name="Total Documents Processed">0</str>
<str name="Total Documents Skipped">0</str>
<str name="Full Dump Started">2009-01-20 14:21:36</str>
<str name="">Indexing failed. Rolled back all changes.</str>
<str name="Rolledback">2009-01-20 14:21:36</str>
</lst>
<str name="WARNING">This response format is experimental. It is
likely to change in the future.</str>
</response>
Adding some data e.g. via curl works fine. So, I think the schema.xml is
correct.
I hope somebody can help.
Thanks,
Nick
--
--Noble Paul
Nick Friedrich
2009-01-20 15:59:12 UTC
Permalink
no, there are no exceptions
but I have to admit, that I'm not sure what you mean with console
Post by Noble Paul നോബിള്‍ नोब्ळ्
it got rolled back
any exceptions on solr console?
--
--Noble Paul
Shalin Shekhar Mangar
2009-01-21 18:07:33 UTC
Permalink
I guess Noble meant the Solr log.

On Tue, Jan 20, 2009 at 9:29 PM, Nick Friedrich <
Post by Nick Friedrich
no, there are no exceptions
but I have to admit, that I'm not sure what you mean with console
it got rolled back
Post by Noble Paul നോബിള്‍ नोब्ळ्
any exceptions on solr console?
--
--Noble Paul
--
Regards,
Shalin Shekhar Mangar.
Loading...