My view displays Webinars, I use facets to choose between upcoming and archived.

The default sort order is ASC, which is fine for upcoming dates, but if you select the archived facet, I need the sort order to change to DESC. Any ideas?

1 Answer 1


This is how i solved the problem in the end, i checked the current path using request_path() and if it matched my facet url, then use the search_api_query_alter hook to reverse the sort order:

function MYMODULE_search_api_query_alter(SearchApiQueryInterface $query) {
    $query->sort('my_field_name', 'DESC');

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.