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 = &$view->result;
$to_search_top = array();
foreach ( $results as $i => $capacity){
if ((int) $capacity->{_entity_properties}['field_free_capacity_company_ref:field_last_review'] > 1) {
unset($results[$i]);
$to_search_top[] = $capacity;
}
}
foreach ($to_search_top as $capa) {
array_unshift($results, $capa);
}
Thank