cancel
Showing results for 
Search instead for 
Did you mean: 

Solr cannot index dates

anghelutar
Champ in-the-making
Champ in-the-making
Hello,

I am trying to index the fields which have type d_datetime as proper date fields (type "date" or "tdate") in Solr. For this, I have added the type and the field in schema.xml:


fieldType name="date" class="solr.DateField" sortMissingLast="true" omitNorms="true"
….
field name="@{http://www.xenit.eu/fred/example/model/0.1}purchase_date" type="tdate" indexed="true" stored="true"

However, they are not indexed and the message in the log are:


WARNING: Node index failed and skipped for 861 in Tx 46
org.apache.solr.common.SolrException: Invalid Date String:'2013-02-01T19:26:54.000+01:00'
        at org.apache.solr.schema.DateField.parseMath(DateField.java:163)
        at org.apache.solr.schema.TrieDateField.createField(TrieDateField.java:171)
        at org.apache.solr.schema.SchemaField.createField(SchemaField.java:94)
        at org.alfresco.solr.tracker.CoreTracker.toDocument(CoreTracker.java:3458)
        at org.alfresco.solr.tracker.CoreTracker.indexNode(CoreTracker.java:2344)
        at org.alfresco.solr.tracker.MultiThreadedCoreTracker$NodeIndexWorkerRunnable.doWork(MultiThreadedCoreTracker.java:806)
        at org.alfresco.solr.tracker.MultiThreadedCoreTracker$AbstractWorkerRunnable.run(MultiThreadedCoreTracker.java:747)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)

I think this is because Solr only understands UTC dates. Is there any way to convert Alfresco's dates to UTC?

Thanks,
roxana
1 REPLY 1

jego
Star Contributor
Star Contributor
Hi roxana,

why not using the built-in support of Alfresco for date fields in SOLR?
Thanks,
Jens