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 shankhamajumdar <sh...@lexmark.com> on 2017/09/20 10:32:47 UTC

Not able to import timestamp data into Solr

Hi,

I have a field with timestamp data in Cassandra for example - 2017-09-20
10:25:46.752000+0000.
I am not able to import the data using Solr DataImportHandler, getting the
bellow error in the Solr log.

Caused by: java.lang.StringIndexOutOfBoundsException: String index out of
range: -1

I am able to import other datatype data from Cassandra to Solr. I am using
below configuration 
managed-schema
<field name="test_data1" type="string" indexed="true" stored="true"
required="true" multiValued="false" />
    <field name="test_data2" type="string" indexed="true" stored="true"
required="true" multiValued="false" />
    <field name="test_data3" type="string" indexed="true" stored="true"
required="true" multiValued="false" />
    <field name="upserttime" type="date"   indexed="true" stored="true"
required="true"  multiValued="false" />

dataconfig.xml
query="SELECT test_data1,test_data2,test_data3, upserttime from test_table"
autoCommit="true">
<field column="test_data1" name="test_data1" />
<field column="test_data2" name="test_data2" />
<field column="test_data3" name="test_data3" />
<field column="upserttime" name="upserttime" />

Regards,
Shankha





--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: Not able to import timestamp data into Solr

Posted by shankhamajumdar <sh...@lexmark.com>.
Hi,

I have gone through the below link and tried with different options. But
still getting the same error.
http://lucene.apache.org/solr/guide/6_6/working-with-dates.html

Can you please check the below configuration and let me know what is wrong
there?

managed-schema 
 <field name="test_data1" type="string" indexed="true" stored="true" 
 required="true" multiValued="false" /> 
     <field name="test_data2" type="string" indexed="true" stored="true" 
 required="true" multiValued="false" /> 
    <field name="test_data3" type="string" indexed="true" stored="true" 
 required="true" multiValued="false" /> 
    <field name="upserttime" type="date"   indexed="true" stored="true" 
 required="true"  multiValued="false" /> 

dataconfig.xml 
 query="SELECT test_data1,test_data2,test_data3, upserttime from 
 test_table" 
autoCommit="true"> 
<field column="test_data1" name="test_data1" /> 
 <field column="test_data2" name="test_data2" /> 
 <field column="test_data3" name="test_data3" /> 
 <field column="upserttime" name="upserttime" /> 

The timestamp data in Cassandra for example - 2017-09-20
10:25:46.752000+0000

Regards,
Shankha
 



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: Not able to import timestamp data into Solr

Posted by Susheel Kumar <su...@gmail.com>.
Checkout this article for working with date types and format etc.
http://lucene.apache.org/solr/guide/6_6/working-with-dates.html

On Wed, Sep 20, 2017 at 6:32 AM, shankhamajumdar <
shankha.majumdar@lexmark.com> wrote:

> Hi,
>
> I have a field with timestamp data in Cassandra for example - 2017-09-20
> 10:25:46.752000+0000.
> I am not able to import the data using Solr DataImportHandler, getting the
> bellow error in the Solr log.
>
> Caused by: java.lang.StringIndexOutOfBoundsException: String index out of
> range: -1
>
> I am able to import other datatype data from Cassandra to Solr. I am using
> below configuration
> managed-schema
> <field name="test_data1" type="string" indexed="true" stored="true"
> required="true" multiValued="false" />
>     <field name="test_data2" type="string" indexed="true" stored="true"
> required="true" multiValued="false" />
>     <field name="test_data3" type="string" indexed="true" stored="true"
> required="true" multiValued="false" />
>     <field name="upserttime" type="date"   indexed="true" stored="true"
> required="true"  multiValued="false" />
>
> dataconfig.xml
> query="SELECT test_data1,test_data2,test_data3, upserttime from
> test_table"
> autoCommit="true">
> <field column="test_data1" name="test_data1" />
> <field column="test_data2" name="test_data2" />
> <field column="test_data3" name="test_data3" />
> <field column="upserttime" name="upserttime" />
>
> Regards,
> Shankha
>
>
>
>
>
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
>