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 MapYours <ma...@gmail.com> on 2008/12/30 01:19:03 UTC

Local Solr - Error creating document with DIH

I have my data import handler set up correctly it connects and streams
results returned from the database (sqlserver 2005) using JTDS driver.

However, no documents are indexed:
Dec 29, 2008 2:03:07 PM org.apache.solr.handler.dataimport.SolrWriter upload
WARNING: Error creating document :
SolrInputDocumnt[{incident_num=incident_num(1.0)={08518194 },
incident_date=incident_date(1.0)={2008-12-29 00:00:00.0},
location=location(1.0)={4300BLK SW 173RD AVE                                 
}, lat=lat(1.0)={45.4882}, lng=lng(1.0)={-122.85455}}]
java.lang.ClassCastException: java.lang.Double cannot be cast to
java.lang.String
        at
com.pjaol.search.solr.update.LocalUpdaterProcessor.processAdd(LocalUpdateProcessorFactory.java:136)
        at
org.apache.solr.handler.dataimport.SolrWriter.upload(SolrWriter.java:69)
        at
org.apache.solr.handler.dataimport.DataImportHandler$1.upload(DataImportHandler.java:288)
        at
org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:319)
        at
org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:178)
        at
org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:136)
        at
org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:334)
        at
org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:386)
        at
org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:377)

Here is my schema:
<fields>
   <field name="incident_num" type="text" indexed="true" stored="true"/>
   <field name="incident_date" type="date" indexed="true" stored="true"/>
   <field name="location" type="text" indexed="true" stored="true" />
   
<!-- local lucene field types -->
   <field name="lat" type="sdouble" indexed="true" stored="true"/>
   <field name="lng" type="sdouble" indexed="true" stored="true"/>
   
    <dynamicField name="_local*" type="sdouble" indexed="true"
stored="true"/>
 </fields>

 <!-- field to use to determine and enforce document uniqueness. -->
 <uniqueKey>incident_num</uniqueKey>

 <!-- field for the QueryParser to use when an explicit fieldname is absent
-->
 <defaultSearchField>location</defaultSearchField>

-- 
View this message in context: http://www.nabble.com/Local-Solr---Error-creating-document-with-DIH-tp21211133p21211133.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Local Solr - Error creating document with DIH

Posted by MapYours <ma...@gmail.com>.
Thanks,
That worked perfectly.


Noble Paul നോബിള്‍ नोब्ळ् wrote:
> 
> apparently the local solr expects everything as string. I guess we
> must raise an issue with them.
> meanwhile you can convert those double fields to String using
> TemplateTransformer
> 
> <field column="lat" template="${your_entity_name.lat}"/>
>   <field column="lng" template="${your_entity_name.lng}"/>
> 
> 
> 
> On Tue, Dec 30, 2008 at 5:49 AM, MapYours <ma...@gmail.com> wrote:
>>
>> I have my data import handler set up correctly it connects and streams
>> results returned from the database (sqlserver 2005) using JTDS driver.
>>
>> However, no documents are indexed:
>> Dec 29, 2008 2:03:07 PM org.apache.solr.handler.dataimport.SolrWriter
>> upload
>> WARNING: Error creating document :
>> SolrInputDocumnt[{incident_num=incident_num(1.0)={08518194 },
>> incident_date=incident_date(1.0)={2008-12-29 00:00:00.0},
>> location=location(1.0)={4300BLK SW 173RD AVE
>> }, lat=lat(1.0)={45.4882}, lng=lng(1.0)={-122.85455}}]
>> java.lang.ClassCastException: java.lang.Double cannot be cast to
>> java.lang.String
>>        at
>> com.pjaol.search.solr.update.LocalUpdaterProcessor.processAdd(LocalUpdateProcessorFactory.java:136)
>>        at
>> org.apache.solr.handler.dataimport.SolrWriter.upload(SolrWriter.java:69)
>>        at
>> org.apache.solr.handler.dataimport.DataImportHandler$1.upload(DataImportHandler.java:288)
>>        at
>> org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:319)
>>        at
>> org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:178)
>>        at
>> org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:136)
>>        at
>> org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:334)
>>        at
>> org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:386)
>>        at
>> org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:377)
>>
>> Here is my schema:
>> <fields>
>>   <field name="incident_num" type="text" indexed="true" stored="true"/>
>>   <field name="incident_date" type="date" indexed="true" stored="true"/>
>>   <field name="location" type="text" indexed="true" stored="true" />
>>
>> <!-- local lucene field types -->
>>   <field name="lat" type="sdouble" indexed="true" stored="true"/>
>>   <field name="lng" type="sdouble" indexed="true" stored="true"/>
>>
>>    <dynamicField name="_local*" type="sdouble" indexed="true"
>> stored="true"/>
>>  </fields>
>>
>>  <!-- field to use to determine and enforce document uniqueness. -->
>>  <uniqueKey>incident_num</uniqueKey>
>>
>>  <!-- field for the QueryParser to use when an explicit fieldname is
>> absent
>> -->
>>  <defaultSearchField>location</defaultSearchField>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Local-Solr---Error-creating-document-with-DIH-tp21211133p21211133.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> --Noble Paul
> 
> 

-- 
View this message in context: http://www.nabble.com/Local-Solr---Error-creating-document-with-DIH-tp21211133p21220673.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Local Solr - Error creating document with DIH

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@gmail.com>.
apparently the local solr expects everything as string. I guess we
must raise an issue with them.
meanwhile you can convert those double fields to String using
TemplateTransformer

<field column="lat" template="${your_entity_name.lat}"/>
  <field column="lng" template="${your_entity_name.lng}"/>



On Tue, Dec 30, 2008 at 5:49 AM, MapYours <ma...@gmail.com> wrote:
>
> I have my data import handler set up correctly it connects and streams
> results returned from the database (sqlserver 2005) using JTDS driver.
>
> However, no documents are indexed:
> Dec 29, 2008 2:03:07 PM org.apache.solr.handler.dataimport.SolrWriter upload
> WARNING: Error creating document :
> SolrInputDocumnt[{incident_num=incident_num(1.0)={08518194 },
> incident_date=incident_date(1.0)={2008-12-29 00:00:00.0},
> location=location(1.0)={4300BLK SW 173RD AVE
> }, lat=lat(1.0)={45.4882}, lng=lng(1.0)={-122.85455}}]
> java.lang.ClassCastException: java.lang.Double cannot be cast to
> java.lang.String
>        at
> com.pjaol.search.solr.update.LocalUpdaterProcessor.processAdd(LocalUpdateProcessorFactory.java:136)
>        at
> org.apache.solr.handler.dataimport.SolrWriter.upload(SolrWriter.java:69)
>        at
> org.apache.solr.handler.dataimport.DataImportHandler$1.upload(DataImportHandler.java:288)
>        at
> org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:319)
>        at
> org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:178)
>        at
> org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:136)
>        at
> org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:334)
>        at
> org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:386)
>        at
> org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:377)
>
> Here is my schema:
> <fields>
>   <field name="incident_num" type="text" indexed="true" stored="true"/>
>   <field name="incident_date" type="date" indexed="true" stored="true"/>
>   <field name="location" type="text" indexed="true" stored="true" />
>
> <!-- local lucene field types -->
>   <field name="lat" type="sdouble" indexed="true" stored="true"/>
>   <field name="lng" type="sdouble" indexed="true" stored="true"/>
>
>    <dynamicField name="_local*" type="sdouble" indexed="true"
> stored="true"/>
>  </fields>
>
>  <!-- field to use to determine and enforce document uniqueness. -->
>  <uniqueKey>incident_num</uniqueKey>
>
>  <!-- field for the QueryParser to use when an explicit fieldname is absent
> -->
>  <defaultSearchField>location</defaultSearchField>
>
> --
> View this message in context: http://www.nabble.com/Local-Solr---Error-creating-document-with-DIH-tp21211133p21211133.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>



-- 
--Noble Paul