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
Comment #1
Daniel Schaefer CreditAttribution: Daniel Schaefer commentedComment #2
Daniel Schaefer CreditAttribution: Daniel Schaefer commentedComment #3
Daniel Schaefer CreditAttribution: Daniel Schaefer commentedComment #4
eugene.ilyin CreditAttribution: eugene.ilyin as a volunteer and at DrupalJedi commentedThe 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.
Comment #5
eugene.ilyin CreditAttribution: eugene.ilyin as a volunteer and at DrupalJedi commented