We are using SolrNet API to Index and Search a set of documents which contains three date fields: Date1, Date2, Date3. The C# class has the following definitions for the three fields
public DateTime? Date1{ get; set; }
public DateTime? Date2{ get; set; }
public DateTime? Date3{ get; set; }
The Solr schema definition is as follows:
<field name="Date1" type="date" indexed="false" stored="true" required="false"/>
<field name="Date2" type="date" indexed="false" stored="true" required="false"/>
<field name="Date3" type="date" indexed="false" stored="true" required="false"/>
When we execute a query with a document which has already been indexed, we get the following values returned in the SolrAdmin interface:
<date name="Date1">0001-01-01T00:00:00Z</date>
<date name="Date2">2010-04-10T08:21:18.281Z</date>
<date name="Date3">2007-12-01T03:09:41.093Z</date>
But when we inspect the C# object which gets returned with the SolrQueryResults, it shows the following:
Date1 : {01-01-0001 12:00:00 AM}
Date2 : null
Date3 : null
The first date is being represented as the datetime min value which is expected. But why are the other dates getting null values when these are valid dates in the UTC format?
Is it better to store the date fields as strings in Solr and use a copy field to store it in the solr date format and use this field for date range queries?
Check that you are returning the Date2 and Date3 fields in your SolrNet query results. e.g. Make sure that you are not limiting the fields with &fl
parameter via SolrNet Fields
QueryOptions or using a requestHandler on the Solr instance that is filtering fields and does not include those fields.