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 Fiz N <fi...@gmail.com> on 2020/11/20 20:49:37 UTC

SOLR 8.6.0 date Indexing Issues.

Hello Experts,

I am having  issues with indexing Date field in SOLR 8.6.0. I am indexing
from MongoDB. In MongoDB the Format is as follows


* "R_CREATION_DATE" : "12-Jul-18",  "R_MODIFY_DATE" : "30-Apr-19", *

 In my Managed Schema I have the following entries.
 <field name="R_CREATION_DATE" type="rdate" indexed="true" stored="true"/>
 <field name="R_MODIFY_DATE" type="rdate" indexed="true" stored="true"/>


 <fieldType name="rdate" class="solr.DateRangeField"/>.

 I am getting an error in the Solr log.

* org.apache.solr.common.SolrException: ERROR: [doc=mt_100] Error adding
field 'R_MODIFY_DATE'='15-Jul-19' msg=Couldn't parse date because:
Improperly formatted datetime: 15-Jul-19*

 Please let me know how to handle this usecase with Date format
"12-JUL-18". what changes should I do to make it work ?

 Thanks
 Fiz N.

Re: SOLR 8.6.0 date Indexing Issues.

Posted by Jörn Franke <jo...@gmail.com>.
Your should format the date according to the ISO Standard: 

https://lucene.apache.org/solr/guide/6_6/working-with-dates.html

Eg. 2018-07-12T00:00:00Z

You can either transform the date that you have in Solr or in your client pushing the doc to Solr. 
All major programming language have date utilities that allow you do to this transformation easily.


> Am 20.11.2020 um 21:50 schrieb Fiz N <fi...@gmail.com>:
> 
> Hello Experts,
> 
> I am having  issues with indexing Date field in SOLR 8.6.0. I am indexing
> from MongoDB. In MongoDB the Format is as follows
> 
> 
> * "R_CREATION_DATE" : "12-Jul-18",  "R_MODIFY_DATE" : "30-Apr-19", *
> 
> In my Managed Schema I have the following entries.
> <field name="R_CREATION_DATE" type="rdate" indexed="true" stored="true"/>
> <field name="R_MODIFY_DATE" type="rdate" indexed="true" stored="true"/>
> 
> 
> <fieldType name="rdate" class="solr.DateRangeField"/>.
> 
> I am getting an error in the Solr log.
> 
> * org.apache.solr.common.SolrException: ERROR: [doc=mt_100] Error adding
> field 'R_MODIFY_DATE'='15-Jul-19' msg=Couldn't parse date because:
> Improperly formatted datetime: 15-Jul-19*
> 
> Please let me know how to handle this usecase with Date format
> "12-JUL-18". what changes should I do to make it work ?
> 
> Thanks
> Fiz N.