JdbcDataSource convertType attribute is not working with implicit fields
------------------------------------------------------------------------
Key: SOLR-2102
URL: https://issues.apache.org/jira/browse/SOLR-2102
Project: Solr
Issue Type: Bug
Components: contrib - DataImportHandler
Affects Versions: 1.4.1
Reporter: Alexey Serba
JdbcDataSource convertType attribute doesn't take any effect on implicit fields ( fields that
are not listed in [field declaration section|http://wiki.apache.org/solr/DataImportHandler#Field_declarations]
).
For example you might have the following configuration:
{noformat:title=dataconfig}
<?xml version="1.0" encoding="UTF-8"?>
<dataConfig>
<dataSource batchSize="-1" convertType="true" driver="com.mysql.jdbc.Driver"
password="pass" url="jdbc:mysql://localhost/test" user="root"/>
<document name="items">
<entity query="SELECT title, body, tm FROM articles order by title desc">
</entity>
</document>
{noformat}
where
* tm is timestamp in mysql database
* tm is date in schema.xml
Because field _tm_ is not explicitly stated in fields declaration _convertType_ attribute
doesn't take any effect and as a result you would get the following exception:
{noformat:title=convertType exception}
Sep 6, 2010 2:22:09 AM org.apache.solr.handler.dataimport.SolrWriter upload
WARNING: Error creating document : SolrInputDocument[{body=body(1.0)={Apache Lucene is a free/open
source information retrieval software library, originally created in Java by Doug Cutting.},
tm=tm(1.0)={2010-09-06 02:06:25.0}, title=title(1.0)={Lucene}}]
org.apache.solr.common.SolrException: Error while creating field 'tm{type=date,default=NOW,properties=indexed,stored,omitNorms,sortMissingLast}'
from value '2010-09-06 02:06:25.0'
at org.apache.solr.schema.FieldType.createField(FieldType.java:242)
at org.apache.solr.schema.SchemaField.createField(SchemaField.java:94)
at org.apache.solr.update.DocumentBuilder.addField(DocumentBuilder.java:204)
at org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:277)
at org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:60)
at org.apache.solr.handler.dataimport.SolrWriter.upload(SolrWriter.java:75)
at org.apache.solr.handler.dataimport.DataImportHandler$1.upload(DataImportHandler.java:292)
at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:618)
at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:260)
at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:184)
at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:334)
at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:392)
at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:373)
Caused by: org.apache.solr.common.SolrException: Invalid Date String:'2010-09-06 02:06:25.0'
at org.apache.solr.schema.DateField.parseMath(DateField.java:166)
at org.apache.solr.schema.DateField.toInternal(DateField.java:136)
at org.apache.solr.schema.FieldType.createField(FieldType.java:240)
... 12 more
{noformat}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
|