You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Alexey Serba (JIRA)" <ji...@apache.org> on 2010/09/06 10:09:34 UTC

[jira] Issue Comment Edited: (SOLR-2102) JdbcDataSource convertType attribute is not working with implicit fields

    [ https://issues.apache.org/jira/browse/SOLR-2102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12906445#action_12906445 ] 

Alexey Serba edited comment on SOLR-2102 at 9/6/10 4:09 AM:
------------------------------------------------------------

{quote}
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.
{quote}
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 | http://lucene.apache.org/solr/api/org/apache/solr/schema/IndexSchema.html#getFieldOrNull%28java.lang.String%29] supports dynamic field matching also.

Thanks Lance!

      was (Author: alexey):
    {quote}
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.
{quote}
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 | http://lucene.apache.org/solr/api/org/apache/solr/schema/IndexSchema.html#getFieldOrNull%28java.lang.String%29] supports dynamic field matching also.

Thanks Lance!
  
> 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
>
>
> 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