In the past I found that the only way I can do date search was to use the default start field from search field types.
As you can see that it has the Start field and some date value and it does return the results. Also you can use the END date field there.
Combination of those 2 date might help you achieve what you are looking for.
You have another option there to Search by field values. Hopefully that will help you.
After reading comments I thought to provide a full updated answer than just hint. I spent some time and now I wrote this blog post here on how to do this: How to use Sitecore Search for Date fields?
So all you need to do is following:
- Go to the
/sitecore/system/Settings/Buckets/Search Types/Start Date
- Copy paste it to
/sitecore/system/Settings/Buckets/Search Types/User Defined
- Rename it to match it to your date field. In my example I am going to make it to
Resource Spotlight Start Date
- Update below values in the field to make sure it searched for your field and not the start field.
In the above image
1 is to change the icon in the search interface.
2 is must for changing it to your desired field name. It does not need to be your exact field name but something unique to indicate user.
3 is for field. Here you should put your actual field name. If you have doubts on what is your exact field name then open the LUKE and then find your field’s name. In my instance my field name under template was Resource Spotlight Start Date but under LUKE it was resource_spotlight_start_date.
4 is for control type parameters and that can be same as your name too.
5 is for Displaying text for your user.
Once you do this you will see nice shiny field created by you in the search interface.
Now when you click it you will observe that it gives you calendar search.
But if you select it and hit run it won't give you any results. Why?
Well you need to do this one last step: go to your app_config/include and find the file Sitecore.ContentSearch.Lucene.DefaultIndexConfiguration.config.
Open the file and add this line
<field fieldName=”resource_spotlight_start_date” storageType=”YES” indexType=”TOKENIZED” vectorType=”NO” boost=”1f” type=”System.DateTime” format=”yyyyMMddTHHmmZ” settingType=”Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider”>
<fieldNames> section. This ensures that your master index and lucene consider your newly created field to be date searchable.
Once you add this close your config, rebuild indexes and search again from step 11.
Boom you will see below results.
To answer the comment I needed to update the actual answer.
So when I was looking into search logs while I used the filtering by field value for date field and compared it with the start date field I found below:
For search by field:
+_datasource:sitecore +(+_latestversion:1 +(+_path:433f55f1b8cd4254ad0e43d221110b77 +resource_spotlight_start_date:"20170201t050000000z 20170202t045959000z"))
for search by date
+_datasource:sitecore +(+_latestversion:1 +(+_path:433f55f1b8cd4254ad0e43d221110b77 +__smallcreateddate:[20170201t0500z TO 99991231t0459z]))
I think Sitecore was comparing it as string value then the actual date value and that is where adding the field to the Lucene config as date value started making it treating as date value.
One thing I have not tried is just updated the Lucene file but don't create the custom search field and see if you can find the results.