ParseException : Unable to index date in ISODate("2019-03-12T21:53:16.841Z") format in SOLR 5.4.1

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

ParseException : Unable to index date in ISODate("2019-03-12T21:53:16.841Z") format in SOLR 5.4.1

Abhijit Pawar-3
Hello,

I am trying to index date in ISODate format like this saved in mongoDB
collection using DataImortHandler in SOLR 5.4.1:
{
.
.
"endDate" : ISODate("2019-03-12T21:53:16.841Z")
}

It  throws below error:
*java.text.ParseException: Unparseable date: "Tue Mar 12 21:53:16 UTC 2019"*

Below is the configuration SOLR:

*data-source-config.xml:*

<entity name="products"
dataSource="mongod"
transformer="ProdsCatsFieldTransformer,TemplateTransformer"
onError="continue"
pk="uuid"
query="<< query >>"
deltaImportQuery="<<deltaImportQuery>>"
>
      <field column="endDate" name="prodendDate" />


<entity name="categories"

dataSource="mongod"

transformer="TemplateTransformer,DateFormatTransformer"

onError="continue"

pk="uuid"

child="true"

query="<<query >>"

deltaImportQuery="<<deltaImportQuery>>"

parentDeltaQuery="<<parentDeltaQuery>>'">

*<field column="prodendDate" template="${products.endDate}" />*

* <field column="endDate" sourceColName="prodendDate"
dateTimeFormat="yyyy-MM-dd'T'HH:mm:ss.SSSZ" locale="en"/>*

 </entity>

</entity>

*schema.xml:*
<field name="prodendDate" type="string" indexed="true" stored="false"
required="false" />
*<field name="endDate" type="date" indexed="true" stored="true"
required="false"/>*

Even tried with yyyy-MM-dd'T'HH:mm:ss format but no luck.

Any idea what could be the issue here...
Reply | Threaded
Open this post in threaded view
|

Re: ParseException : Unable to index date in ISODate("2019-03-12T21:53:16.841Z") format in SOLR 5.4.1

Erick Erickson
Well, the thing you’re getting back from MongoDB isn’t the ISO date format. I don’t know enough about MongoDB to understand how to get it to spit out the date in the correct format, but that’s where you need to look.

Best,
Erick

> On May 10, 2019, at 2:13 PM, Abhijit Pawar <[hidden email]> wrote:
>
> Hello,
>
> I am trying to index date in ISODate format like this saved in mongoDB
> collection using DataImortHandler in SOLR 5.4.1:
> {
> .
> .
> "endDate" : ISODate("2019-03-12T21:53:16.841Z")
> }
>
> It  throws below error:
> *java.text.ParseException: Unparseable date: "Tue Mar 12 21:53:16 UTC 2019"*
>
> Below is the configuration SOLR:
>
> *data-source-config.xml:*
>
> <entity name="products"
> dataSource="mongod"
> transformer="ProdsCatsFieldTransformer,TemplateTransformer"
> onError="continue"
> pk="uuid"
> query="<< query >>"
> deltaImportQuery="<<deltaImportQuery>>"
>>
>      <field column="endDate" name="prodendDate" />
>
>
> <entity name="categories"
>
> dataSource="mongod"
>
> transformer="TemplateTransformer,DateFormatTransformer"
>
> onError="continue"
>
> pk="uuid"
>
> child="true"
>
> query="<<query >>"
>
> deltaImportQuery="<<deltaImportQuery>>"
>
> parentDeltaQuery="<<parentDeltaQuery>>'">
>
> *<field column="prodendDate" template="${products.endDate}" />*
>
> * <field column="endDate" sourceColName="prodendDate"
> dateTimeFormat="yyyy-MM-dd'T'HH:mm:ss.SSSZ" locale="en"/>*
>
> </entity>
>
> </entity>
>
> *schema.xml:*
> <field name="prodendDate" type="string" indexed="true" stored="false"
> required="false" />
> *<field name="endDate" type="date" indexed="true" stored="true"
> required="false"/>*
>
> Even tried with yyyy-MM-dd'T'HH:mm:ss format but no luck.
>
> Any idea what could be the issue here...

Reply | Threaded
Open this post in threaded view
|

Re: ParseException : Unable to index date in ISODate("2019-03-12T21:53:16.841Z") format in SOLR 5.4.1

Walter Underwood
"2019-03-12T21:53:16.841Z” is an ISO 8601 date.

"ISODate("2019-03-12T21:53:16.841Z”)” is not an ISO 8601 date.

If you could post what is being sent to Solr, that would be helpful.

wunder
Walter Underwood
[hidden email]
http://observer.wunderwood.org/  (my blog)

> On May 10, 2019, at 7:09 PM, Erick Erickson <[hidden email]> wrote:
>
> Well, the thing you’re getting back from MongoDB isn’t the ISO date format. I don’t know enough about MongoDB to understand how to get it to spit out the date in the correct format, but that’s where you need to look.
>
> Best,
> Erick
>
>> On May 10, 2019, at 2:13 PM, Abhijit Pawar <[hidden email]> wrote:
>>
>> Hello,
>>
>> I am trying to index date in ISODate format like this saved in mongoDB
>> collection using DataImortHandler in SOLR 5.4.1:
>> {
>> .
>> .
>> "endDate" : ISODate("2019-03-12T21:53:16.841Z")
>> }
>>
>> It  throws below error:
>> *java.text.ParseException: Unparseable date: "Tue Mar 12 21:53:16 UTC 2019"*
>>
>> Below is the configuration SOLR:
>>
>> *data-source-config.xml:*
>>
>> <entity name="products"
>> dataSource="mongod"
>> transformer="ProdsCatsFieldTransformer,TemplateTransformer"
>> onError="continue"
>> pk="uuid"
>> query="<< query >>"
>> deltaImportQuery="<<deltaImportQuery>>"
>>>
>>     <field column="endDate" name="prodendDate" />
>>
>>
>> <entity name="categories"
>>
>> dataSource="mongod"
>>
>> transformer="TemplateTransformer,DateFormatTransformer"
>>
>> onError="continue"
>>
>> pk="uuid"
>>
>> child="true"
>>
>> query="<<query >>"
>>
>> deltaImportQuery="<<deltaImportQuery>>"
>>
>> parentDeltaQuery="<<parentDeltaQuery>>'">
>>
>> *<field column="prodendDate" template="${products.endDate}" />*
>>
>> * <field column="endDate" sourceColName="prodendDate"
>> dateTimeFormat="yyyy-MM-dd'T'HH:mm:ss.SSSZ" locale="en"/>*
>>
>> </entity>
>>
>> </entity>
>>
>> *schema.xml:*
>> <field name="prodendDate" type="string" indexed="true" stored="false"
>> required="false" />
>> *<field name="endDate" type="date" indexed="true" stored="true"
>> required="false"/>*
>>
>> Even tried with yyyy-MM-dd'T'HH:mm:ss format but no luck.
>>
>> Any idea what could be the issue here...
>

Reply | Threaded
Open this post in threaded view
|

Re: ParseException : Unable to index date in ISODate("2019-03-12T21:53:16.841Z") format in SOLR 5.4.1

Abhijit Pawar-3
Hello,

"ISODate("2019-03-12T21:53:16.841Z”)”  saves the date in mongoDB as*
2019-05-09 21:53:16.841Z* which is passed to SOLR while indexing.
 It  then throws below error:
*java.text.ParseException: Unparseable date: "Tue Mar 12 21:53:16 UTC 2019"*


On Fri, May 10, 2019 at 9:53 PM Walter Underwood <[hidden email]>
wrote:

> "2019-03-12T21:53:16.841Z” is an ISO 8601 date.
>
> "ISODate("2019-03-12T21:53:16.841Z”)” is not an ISO 8601 date.
>
> If you could post what is being sent to Solr, that would be helpful.
>
> wunder
> Walter Underwood
> [hidden email]
> http://observer.wunderwood.org/  (my blog)
>
> > On May 10, 2019, at 7:09 PM, Erick Erickson <[hidden email]>
> wrote:
> >
> > Well, the thing you’re getting back from MongoDB isn’t the ISO date
> format. I don’t know enough about MongoDB to understand how to get it to
> spit out the date in the correct format, but that’s where you need to look.
> >
> > Best,
> > Erick
> >
> >> On May 10, 2019, at 2:13 PM, Abhijit Pawar <[hidden email]>
> wrote:
> >>
> >> Hello,
> >>
> >> I am trying to index date in ISODate format like this saved in mongoDB
> >> collection using DataImortHandler in SOLR 5.4.1:
> >> {
> >> .
> >> .
> >> "endDate" : ISODate("2019-03-12T21:53:16.841Z")
> >> }
> >>
> >> It  throws below error:
> >> *java.text.ParseException: Unparseable date: "Tue Mar 12 21:53:16 UTC
> 2019"*
> >>
> >> Below is the configuration SOLR:
> >>
> >> *data-source-config.xml:*
> >>
> >> <entity name="products"
> >> dataSource="mongod"
> >> transformer="ProdsCatsFieldTransformer,TemplateTransformer"
> >> onError="continue"
> >> pk="uuid"
> >> query="<< query >>"
> >> deltaImportQuery="<<deltaImportQuery>>"
> >>>
> >>     <field column="endDate" name="prodendDate" />
> >>
> >>
> >> <entity name="categories"
> >>
> >> dataSource="mongod"
> >>
> >> transformer="TemplateTransformer,DateFormatTransformer"
> >>
> >> onError="continue"
> >>
> >> pk="uuid"
> >>
> >> child="true"
> >>
> >> query="<<query >>"
> >>
> >> deltaImportQuery="<<deltaImportQuery>>"
> >>
> >> parentDeltaQuery="<<parentDeltaQuery>>'">
> >>
> >> *<field column="prodendDate" template="${products.endDate}" />*
> >>
> >> * <field column="endDate" sourceColName="prodendDate"
> >> dateTimeFormat="yyyy-MM-dd'T'HH:mm:ss.SSSZ" locale="en"/>*
> >>
> >> </entity>
> >>
> >> </entity>
> >>
> >> *schema.xml:*
> >> <field name="prodendDate" type="string" indexed="true" stored="false"
> >> required="false" />
> >> *<field name="endDate" type="date" indexed="true" stored="true"
> >> required="false"/>*
> >>
> >> Even tried with yyyy-MM-dd'T'HH:mm:ss format but no luck.
> >>
> >> Any idea what could be the issue here...
> >
>
>
Reply | Threaded
Open this post in threaded view
|

Re: ParseException : Unable to index date in ISODate("2019-03-12T21:53:16.841Z") format in SOLR 5.4.1

Shawn Heisey-2
On 5/11/2019 2:06 PM, Abhijit Pawar wrote:
> "ISODate("2019-03-12T21:53:16.841Z”)”  saves the date in mongoDB as*
> 2019-05-09 21:53:16.841Z* which is passed to SOLR while indexing.
>   It  then throws below error:
> *java.text.ParseException: Unparseable date: "Tue Mar 12 21:53:16 UTC 2019"*

If that error is coming from Solr, it clearly states that what Solr is
receiving is "Tue Mar 12 21:53:16 UTC 2019" ... not the ISO format.

You do have a date transform configured, but it is looking for the ISO
format, not the format that Solr is receiving.

Thanks,
Shawn