lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey Serba (JIRA)" <>
Subject [jira] Updated: (SOLR-2102) JdbcDataSource convertType attribute is not working with implicit fields
Date Mon, 06 Sep 2010 08:05:34 GMT


Alexey Serba updated SOLR-2102:

    Attachment: SOLR-2102.patch

The (equals 'int or sint') etc. code dates from 1.3. You might wish to update these clauses
to include the 1.4 'pint/tint' etc. versions. Also date/sdate/ pdate/tdate.
I've updated patch with these clauses. 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, but it would be more invasive fix...

Also I found that resultSet.getTimestamp is more appropriate for Solr date type than resultSet.getDate.

bq. This code does not support wildcarded field names, which is OK.
This is not true. [ IndexSchema.getFieldOrNull |]
supports dynamic field matching also.

Thanks Lance!

> JdbcDataSource convertType attribute is not working with implicit fields
> ------------------------------------------------------------------------
>                 Key: SOLR-2102
>                 URL:
>             Project: Solr
>          Issue Type: Bug
>          Components: contrib - DataImportHandler
>    Affects Versions: 1.4.1
>            Reporter: Alexey Serba
>         Attachments: 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|]
> 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(
>         at org.apache.solr.schema.SchemaField.createField(
>         at org.apache.solr.update.DocumentBuilder.addField(
>         at org.apache.solr.update.DocumentBuilder.toDocument(
>         at org.apache.solr.update.processor.RunUpdateProcessor.processAdd(
>         at org.apache.solr.handler.dataimport.SolrWriter.upload(
>         at org.apache.solr.handler.dataimport.DataImportHandler$1.upload(
>         at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(
>         at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(
>         at org.apache.solr.handler.dataimport.DocBuilder.execute(
>         at org.apache.solr.handler.dataimport.DataImporter.doFullImport(
>         at org.apache.solr.handler.dataimport.DataImporter.runCmd(
>         at org.apache.solr.handler.dataimport.DataImporter$
> Caused by: org.apache.solr.common.SolrException: Invalid Date String:'2010-09-06 02:06:25.0'
>         at org.apache.solr.schema.DateField.parseMath(
>         at org.apache.solr.schema.DateField.toInternal(
>         at org.apache.solr.schema.FieldType.createField(
>         ... 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:
For additional commands, e-mail:

View raw message