I have a requirement to create a saved search item under our bucket item, that will display all items created in the last X days, where X is 7 by default but client would like to change that.

We use Solr 6.6.2 and Sitecore 8.2 update-6.

I can't use a Date Range facet on the right, because it is not flexible enough and the filter has to be applied automatically when user opens saved search item.

In this link I found that there is a NOW parameter that I can use with Solr, but it does not work.

I tried something like this.

enter image description here


The NOW parameter has to be provided to Solr as a query string parameter, but Sitecore doesn't do that.

1 Answer 1


I'm not entirely sure you can do what you are trying. Yes, Solr does understand "now" In fact, if you take the query and execute from the SOLR admin interface it does work. Unfortunately, it seems when executing through the content editor, it doesn't seem to translate. You can look at this in the search log and you'll see

"(((created_date_tdt:([NOW-7DAYS]) AND _path:(110d559fdea542ea9c1c8a5df7e70ef9)) AND _latestversion:(1)) AND _datasource:(sitecore))&start=0&rows=20&fl=*,score&fq=_indexname:(sitecore_master_index) 36056 13:13:22 INFO Solr Query - ?q=_name:(_lastestversion)&rows=1&fq=_templatename:("Template field")&fq=_indexname:(sitecore_master_index)".

What this tells me is that Sitecore is treating this as text and is probably sending it to SOLR as text instead of evaluating NOW to today's date.

There are 2 solutions that I can think of

  1. Traing them to be able to use "return results by starting date" enter image description here

  2. Write a custom application for the dashboard.

  • Thanks for trying to help. The first option is off, because it has to be automatic to prevent mistakes. They do custom search operations on the search results, and they want to minimize possibility of mistake. The second option is more expensive. I still would like to make it work with the search fitler. As I understand, the NOW parameter has to be provided to solr as a query string parameter to make it work and Sitecore doesn't do that. Commented Nov 8, 2018 at 8:21
  • Yeah, it seems to me that sitecore doesn't evaluate NOW and just treats it as text. I tried $date as well since sitecore will translate that but that didn't work either. Option 2 might be more expensive but it will also provide some flexibility because you will be able to extend it to meet other requirements if need be.
    – Mikeyp
    Commented Nov 8, 2018 at 14:22

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.