I am sending this question out on behalf a college. Which needs a
clarification on solr indexing on  date and sortable fields.

We have declared a field date in schema.xml like below

<field name="premierDate_dt" type="date" indexed="true"  stored="true"
multiValued="false" default="NOW"/>

While indexing if I don't pass any value to this field like
<premierDate_dt/> or <premierDate_dt></premierDate_dt>, I am  getting the
below error 

SEVERE:  org.apache.solr.common.SolrException: Invalid Date String:''
>        at  org.apache.solr.schema.DateField.parseMath(DateField.java:167)
>        at  org.apache.solr.schema.DateField.toInternal(DateField.java:138)
>        at  org.apache.solr.schema.FieldType.createField(FieldType.java:179)
>        at  org.apache.solr.schema.SchemaField.createField(SchemaField.java:93)
>        at  
> org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:243)
>        at  
> org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProces
> sorFactory.java:58)
> 

Instead if I remove the tag from the request, it is not giving any  issues.
The same behavious exist for sortable fields as well like sint, slong.  Is
there any work around we can make in schema file?

Or the request needs to be changed accordingly?

A  quick work around for this is declaring the fields as string. But the
limitation would be we can not perform any range search queries on these
fields..

Interestingly,f we replace with all zeros in the date (I.e.
<premierDate_dt>0000-00-00T00:00:00Z</premierDate_dt>,
It gets indexed and the value in index is created as 0002-11-30T00:00:00.


Thanks.

Reply via email to