If you need to change the sort order of the Drupal 7 Search API using code, here is an example using hook_search_api_query_alter:
1 2 3 |
function MYMODULE_search_api_query_alter(SearchApiQueryInterface $query) { $query->sort('my_field_name', 'DESC'); } |