0

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?

0

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');
}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.