I want to change default date format in solr "yyyy-mm-ddThh:mm:ssZ" into "yyyy-mm-dd". To change date format what is the file should change inside solr folder? Where and what is the configuration file which can configure date foramt?
How to change date format in solr yyyy-mm-ddThh:mm:ssZ into " yyyy-mm-dd"?
Asked Answered
The date format used is a restricted form of the canonical representation of dateTime in the XML Schema specification. You can not change the solr default date format.
And schema.xml
is the file to configure the date field.
Example:
<field name="Date" datetimeformat="YYYY-MM-DD'T'HH:mm:sss'Z'"
indexed="true" multivalued="false" stored='true' type="date"> </field>
Your answer helps me lot and we can not change default date format to correctly index date Mysql database should have "DateTime"/Timestamp data type for date column. –
Ungenerous
You probably don't want capital YYYY because that is the week-year, you want lowercase yyyy –
Bibliogony
To do this while using javascript I used the split
method.
var newdate = olddate.split("T")[0];
output += newdate;
return output;
Two options
you can perhaps make your XSLT transform the date if importing from XML
use DataImportHandler and DateTransformer: http://wiki.apache.org/solr/DataImportHandler#DateFormatTransformer
© 2022 - 2024 — McMap. All rights reserved.