What would be the best way to set a certain date range as the default for a search page?

I created an event listing and only want to show items which have a date set in the future. Using the latest beta it works great on the facets but I do wonder how do I set a defined set as the default in the Solr search page backend? My field is called field_date so I tried setting the query filter to the string from the url:

bundle:event, dm_field_date:next_30_days

(I defined next_30_days to show events from today + 30 days in the facet configuration)

Then I tried

bundle:event, dm_field_date:[NOW TO *]

and that worked. I just wonder if it is supposed to be that we can not use the machine names as custom filters?

Comments

Daniel Schaefer’s picture

Issue tags: +Apache Solr Search
Daniel Schaefer’s picture

Issue summary: View changes
Daniel Schaefer’s picture

Issue summary: View changes
eugene.ilyin’s picture

The easiest way to set certain date rage by default is use hook_search_api_query_alter(). You should use special syntax like this dm_field_date:[NOW TO *] to define intervals in this hook.

eugene.ilyin’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.