Rose
Rose

Reputation: 1498

Solr: Invalid Date String:'1996'

I am new to Solr. I have indexed some data in my solr(5.1.1). My data has fields like contract_year whose value are like:

contract year: 1996
contract year: 2000

The field type of contract year is "int". I want to change the field type to "date" or "tdate" with just year . For that, I have edited my schema.xml and changed the field type of contract year from "int" to "date". After doing this and reindexing my data, I got this error:

Invalid Date String:'1996'

What should I do to change the field type to "date" and get the same result like

contract year: 1996

without changing the format of date. I want to get only the year(yyyy) from the date. Thanks for your help

Upvotes: 1

Views: 3116

Answers (1)

Saurabh Chaturvedi
Saurabh Chaturvedi

Reputation: 2176

Nupur, the only format that Solr date field support is of the format like this yyyy-MM-dd'T'HH:mm:ss'Z'.So you will have to convert your date in a format like this to be accepted by Apache Solr .

Upvotes: 3

Related Questions