We've solr configured for our 8.2 solution. Recently, a new computed field has been added to the schema. This field is a datetimecollection field which has list of datetimes.

Here is the code for it. We rebuilt the index after adding the new custom field. But then querying on the datetime field using search API isn't working as expected. The data is getting stored in solr indexes as multivalued array of dates. But then when querying the field in Sitecore,the value of this field is always the MinTime (1/1/0001 12 AM). Any clue as to why it's failing.

      <fields hint="raw:AddComputedIndexField">
        <field fieldName="scheduledpublish" returnType="datetimeCollection">classname, assembly</field>
public DateTime ScheduledPublishDateTime { get; set; }

public override object ComputeFieldValue(IIndexable indexable)
    Sitecore.Data.Items.Item item = indexable as SitecoreIndexableItem;
    if (item == null)
        return null;

    var dateList = new List<DateTime>();
    if (item.Publishing.PublishDate != DateTimeOffset.MinValue.UtcDateTime)
    if (item.Publishing.UnpublishDate != DateTimeOffset.MaxValue.UtcDateTime)

    if (item.Publishing.ValidFrom != DateTimeOffset.MinValue.UtcDateTime)
    if (item.Publishing.ValidTo != DateTimeOffset.MaxValue.UtcDateTime)

    return dateList.Count == 0 ? null : dateList;

 var queryResult = searchContxt.GetQueryable<PublishItem>()
                .Filter(f => f.LatestVersion &&
                    f.ScheduledPublishDateTime.Between(publishSpanFrom, publishSpanUntil, Inclusion.Upper))
                .OrderBy(f => f.FullPath)
  • Are the dates in Solr correct when storing? Also, can you share the code on how you are querying the index Jun 5, 2018 at 1:16
  • @HishaamNamooya dates in solr are correct (in UTC). Querying in solr directly through admin interface is also fine. Have updated query above Jun 5, 2018 at 22:39

1 Answer 1


This seems to be an issue with Timezone. After changing my system timezone to UTC, its working as expected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.