Search api solr result reordering on field value I'm using search_api_solr and search_api_location. I have a view with exposed filters to perform geolocation searches.

I'm trying to reorder search result from a solr query based a referenced node's field. My question is witch hook to use, where i can access node fields and reorder the results.

I already tried:


hook_views_pre_render()
hook_views_post_execute()
hook_views_post_render()
hook_views_pre_view()


but reordering is effectless or i don't have access to node fields.
I'm doing something like this:

$results = &amp;$view-&gt;result;
$to_search_top = array();
foreach ( $results as $i =&gt; $capacity){
  if ((int) $capacity-&gt;{_entity_properties}['field_free_capacity_company_ref:field_last_review'] &gt; 1) {
    unset($results[$i]);
    $to_search_top[] = $capacity;
  }
}

foreach ($to_search_top as $capa) {
  array_unshift($results, $capa);
}


Thank
Finaly i was only able to solve this with hook_preprocess_views_view_table().

$to_search_top = array();
foreach ($vars['rows'] as $index =&gt; $row) {
  if ((int) $row['field_company_review_number_1'] &gt; 0) {
    $to_search_top[] = $row;
    unset($vars['rows'][$index]);
  }
}

// Sort reviewed by distance.
usort($to_search_top, function ($item1, $item2) {
    if ($item1['field_free_capacity_coordinates_latlon'] == $item2['field_free_capacity_coordinates_latlon']) {
            return 0;
    }
    return $item1['field_free_capacity_coordinates_latlon'] &gt; $item2['field_free_capacity_coordinates_latlon'] ? -1 : 1;
 });

// Move to results top.
foreach ($to_search_top as $row) {
  array_unshift($vars['rows'], $row);
}