lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey Serba (JIRA)" <j...@apache.org>
Subject [jira] Updated: (SOLR-2102) JdbcDataSource convertType attribute is not working with implicit fields
Date Wed, 08 Sep 2010 07:48:41 GMT

     [ https://issues.apache.org/jira/browse/SOLR-2102?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Alexey Serba updated SOLR-2102:
-------------------------------

    Attachment: SOLR-2102.patch

bq. Another problem is that Solr type names are customizable by user and might be different
from default values. It makes sense to switch from type names to actual class names.
Done in this patch

> 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
>         Attachments: SOLR-2102.patch, SOLR-2102.patch, SOLR-2102.patch, SOLR-2102.patch
>
>
> 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


Mime
View raw message