Search API / Facets: How can I define a range / manipulate the search query in D8? I've defined a facet for the field "Authored on". I'd like to create display filters like "current week", "current month", etc. on my website.

The creation of the links was no problem. I have facet links like this:

&lt;a href="/news?period=current_week"&gt;Current week&lt;/a&gt;


How can I manipulate the search query if a period has been selected? I need something like "get all search results, which are younger than tstamp of monday this week" or "get all search results between date X and date Y".
Afterwards here my solution: I've solved it with condition groups in the hook_search_api_query_alter() function:

function MYMODULE_search_api_query_alter($query) {
    //...

    $conditionGroup = $query-&gt;createConditionGroup('AND');
    $conditionGroup-&gt;addCondition('created', $firstDayOfYear, '&gt;=');
    $conditionGroup-&gt;addCondition('created', $lastDayOfYear, '&lt;=');
    $query-&gt;addConditionGroup($conditionGroup);

    //...
}