Drupal search api custom sort order
I fixed this by using hook_search_api_solr_query_alter() and solr function. Here is my code:

function mymodule_search_api_solr_query_alter(array &amp;$call_args, SearchApiQueryInterface $query) {
  if ($_SESSION['language'] == 'en') {
    $call_args['params']['sort'] = 'termfreq(ss_field_name,EN) desc';
  }
}