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 jokkmokk <jo...@gmx.at> on 2008/12/15 13:34:11 UTC

dataimport handler with mysql: wrong field mapping

HI,

I'm desperately trying to get the dataimport handler to work, however it
seems that it just ignores the field name mapping.
I have the fields "body" and "subject" in the database and those are called
"title" and "content" in the solr schema, so I use the following import
config:

<dataConfig>

<dataSource
    type="JdbcDataSource"
    driver="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost/mydb"
    user="root"
    password=""/>


<document>
    <entity name="phorum_messages" query="select * from phorum_messages">
        <field column="body" name="content"/>
        <field column="subject" name="title"/>
    </entity>
</document>

</dataConfig>

however I always get the following exception:

org.apache.solr.common.SolrException: ERROR:unknown field 'body'
        at
org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:274)
        at
org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:59)
        at
org.apache.solr.handler.dataimport.SolrWriter.upload(SolrWriter.java:69)
        at
org.apache.solr.handler.dataimport.DataImportHandler$1.upload(DataImportHandler.java:279)
        at
org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:317)
        at
org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:179)
        at
org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:137)
        at
org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:326)
        at
org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:386)
        at
org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:367)


but according to the documentation it should add a document with "title" and
"content" not "body" and "subject"?!

I'd appreciate any help as I can't see anything wrong with my
configuration...

TIA,

Stefan
-- 
View this message in context: http://www.nabble.com/dataimport-handler-with-mysql%3A-wrong-field-mapping-tp21013109p21013109.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: dataimport handler with mysql: wrong field mapping

Posted by jokkmokk <jo...@gmx.at>.
sorry, I'm using the 1.3.0 release. I've now worked around that issue by
using aliases in the sql statement so that no mapping is needed. This way it
works perfectly.

best regards

Stefan


Shalin Shekhar Mangar wrote:
> 
> Which solr version are you using?
> 
-- 
View this message in context: http://www.nabble.com/dataimport-handler-with-mysql%3A-wrong-field-mapping-tp21013109p21013639.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: dataimport handler with mysql: wrong field mapping

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
Which solr version are you using?

On Mon, Dec 15, 2008 at 6:04 PM, jokkmokk <jo...@gmx.at> wrote:

>
> HI,
>
> I'm desperately trying to get the dataimport handler to work, however it
> seems that it just ignores the field name mapping.
> I have the fields "body" and "subject" in the database and those are called
> "title" and "content" in the solr schema, so I use the following import
> config:
>
> <dataConfig>
>
> <dataSource
>    type="JdbcDataSource"
>    driver="com.mysql.jdbc.Driver"
>    url="jdbc:mysql://localhost/mydb"
>    user="root"
>    password=""/>
>
>
> <document>
>    <entity name="phorum_messages" query="select * from phorum_messages">
>        <field column="body" name="content"/>
>        <field column="subject" name="title"/>
>    </entity>
> </document>
>
> </dataConfig>
>
> however I always get the following exception:
>
> org.apache.solr.common.SolrException: ERROR:unknown field 'body'
>        at
> org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:274)
>        at
>
> org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:59)
>        at
> org.apache.solr.handler.dataimport.SolrWriter.upload(SolrWriter.java:69)
>        at
>
> org.apache.solr.handler.dataimport.DataImportHandler$1.upload(DataImportHandler.java:279)
>        at
>
> org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:317)
>        at
>
> org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:179)
>        at
> org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:137)
>        at
>
> org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:326)
>        at
>
> org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:386)
>        at
>
> org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:367)
>
>
> but according to the documentation it should add a document with "title"
> and
> "content" not "body" and "subject"?!
>
> I'd appreciate any help as I can't see anything wrong with my
> configuration...
>
> TIA,
>
> Stefan
> --
> View this message in context:
> http://www.nabble.com/dataimport-handler-with-mysql%3A-wrong-field-mapping-tp21013109p21013109.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>


-- 
Regards,
Shalin Shekhar Mangar.

Re: dataimport handler with mysql: wrong field mapping

Posted by Luca Molteni <vo...@gmail.com>.
Have you tried using the

<dynamicField name="*" type="string" indexed="true" />

options in the schema.xml? After the indexing, take a look to the
fields DIH has generated.

Bye,

L.M.



2008/12/15 jokkmokk <jo...@gmx.at>:
>
> HI,
>
> I'm desperately trying to get the dataimport handler to work, however it
> seems that it just ignores the field name mapping.
> I have the fields "body" and "subject" in the database and those are called
> "title" and "content" in the solr schema, so I use the following import
> config:
>
> <dataConfig>
>
> <dataSource
>    type="JdbcDataSource"
>    driver="com.mysql.jdbc.Driver"
>    url="jdbc:mysql://localhost/mydb"
>    user="root"
>    password=""/>
>
>
> <document>
>    <entity name="phorum_messages" query="select * from phorum_messages">
>        <field column="body" name="content"/>
>        <field column="subject" name="title"/>
>    </entity>
> </document>
>
> </dataConfig>
>
> however I always get the following exception:
>
> org.apache.solr.common.SolrException: ERROR:unknown field 'body'
>        at
> org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:274)
>        at
> org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:59)
>        at
> org.apache.solr.handler.dataimport.SolrWriter.upload(SolrWriter.java:69)
>        at
> org.apache.solr.handler.dataimport.DataImportHandler$1.upload(DataImportHandler.java:279)
>        at
> org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:317)
>        at
> org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:179)
>        at
> org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:137)
>        at
> org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:326)
>        at
> org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:386)
>        at
> org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:367)
>
>
> but according to the documentation it should add a document with "title" and
> "content" not "body" and "subject"?!
>
> I'd appreciate any help as I can't see anything wrong with my
> configuration...
>
> TIA,
>
> Stefan
> --
> View this message in context: http://www.nabble.com/dataimport-handler-with-mysql%3A-wrong-field-mapping-tp21013109p21013109.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>