We need to use DateRangeField query in Solr to perform two dates range filter. Managed schema field sample:

<fieldType name="date_range" class="solr.DateRangeField"/>

I have written computed field to add two dates into dateTimeCollection and index to Solr as dateRangeFilter_dtm (computed field)

<field fieldName="dateRangeFilter" returnType="datetimeCollection" storageType="YES" indexType="datetimeCollection">
     xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Namespace xxxxxxxxxxxxx

After indexing this computed field is getting added of type DatePointField (org.apache.solr.schema.DatePointField) in Solr. But we need to index this field of type DateRangeField to perform this query in Solr:

 ({!field f=dateRangeFilter_dtm op=Intersects}[2017-09-30T00:00:00Z TO 2020-10-25T23:59:59Z])

In order to perform this query, the field should be of DateRangeField type only. We tried using both Datetime Array and Datetime Collection returnType, but both are indexing as DatePointField fieldtype in Solr.

Is there an option in Sitecore to use or add DateRangeField typeMatch fieldmap?

Any help would be appreciated!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.